Learning Access, Need help with populating one field withanother...OrderID to OrderID (in Order Deta

J

jscoleman

So I'm working on creating an order tracking database. My 2 main
tables (products and contact tables exist as well) are Orders and
OrderDetails.

Orders table contains basic order information (who ordered it,
required shipping date, approved by, etc), OrderDetails contains the
product thats ordered, the Quantity and so on.

Orders table contains a key field that uses AutoNumber to generate the
key index. I want that Order # to populate OrderID (same field name
on both forms) on the OrderDetails table.

I've tried using SetValue but even though the database is "trusted" I
can't seem to run it. Am I going to be forced to used VBA (which I
have yet to try to learn)?

Right now both forms Orders and OrderDetails both have their own
forms, OrderDetails being the subform placed as a continous form
within Orders form. OrderDetails and Orders are linked by OrderID.

Is there anywhere I can learn more about what I need to do or is there
a simple answer to all of this?

Thanks!
 
J

Jeff Boyce

You don't have to tell Access to do that.

If you use a standard main form/subform construction, Access asks how the
subform is "connected" to the main form. You tell it which fields are
connected and Access handles getting the foreign key value into the
subform's table.

Now the big question... is the OrderID field in your OrderDetails table a
foreign key, or are you trying to use it as a primary key?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top