I don't quite follow what you need to do, but I suspect your design could use
some tightening. When you say "the OrdersForm references Orderstbl and
Companytbl in the Ordersqry" are you saying that the record source for
OrdersForm is Ordersqry, which is based on Orderstbl and Companytbl? If so,
that may not be the correct approach. I would imagine that each order is
associated with a single company, and that each company can have many orders.
In that case there would be a one-to-many relationship between Orderstbl and
Companytbl, but they would not be combined in a query. If the idea is
something like that you select a company from a list, and the address and so
forth are filled in automatically, you could use a subform for the company
information. Another subform could be for the order details. The primary
key from Orderstbl would be the foreign key for both tables.
A question here is what needs to happen if a company gets a new name or
address. When you go back and look at the order do you need to see the
current company address, or do you need to see the address at the time the
order was prepared? If the former you definitely should relate the tables to
each other and procced along lines like I have described. If the latter you
will need to store the values from Companytbl in Orderstbl. To do that I
would be inclined to use the After Update event of the Company combo box
(assuming you are selecting the company from a combo box on OrdersForm) to
populate fields with hidden columns from the combo box row source, but I have
to acknowledge I am not sure that is the best approach.
Your subform record source may have some of the same issues as the main form
with combining tables into a record source query.
It would help if you posted a brief description of relevant table fields,
and the relationships of fields to each other. Then, describe just what
needs to appear on the Orders form. You can certainly keep track of
inventory by counting the quantity of various products, but you would
probably do that separately from the Orders form.
After reading your reply I may need to suggest that you start a new thread,
because some of this may be beyond my skill level (specifically, the
inventory tracking element of your project), but I expect I can help steer
you in the right direction.