OK, so you have a customers table/form. Related information is contacts and
orders.
You should have a form of just customers. You may wish to show a subform
with their contact information, or perhaps a seperate dialog to display that
information. From your customers form you would do just like I pointed out
previously, only in reverse.
In your customer's form add this code with your appropriate table.field names
Private Sub CmdSomeButton_Click()
DoCmd.OpenForm "Orders", , , "Orders_FK_CustomerID=" & Me.CustomerID
End Sub
If you need to see contact information from your orders' form, you would
need to do similar to open a contact information dialog, or have a contacts
subform on your orders form relating the Orders_FK_CustomerID as ParentID and
your ContactInfo_FK_CustomerID as your ChildID.
Does this make sense to you?
Here's what your table structure should look like:
tbl_Customers
att_CustID
att_CustName
att_Cust...
tbl_Orders
att_OrderID
att_Order_FK_CustID
att_Order_FK_ProductID
att_Order...
tbl_ContactInfo
att_CIID
att_CI_FK_CustID
att_CIPhone
att_CI_Addr
att_CI...
Your forms should be relatively the same
There are a number of ways to set up your orders form as a data entry form.
I suggest that you take a look at the Northwind sample DB. The easiest way
to do this is to create a main form which will be your dialog. There you
will want to set your recordsource = "Customers." Name this form
"CustomerOrders."
You will then create a subform and set the recordsource = "Orders." Name
this form "Orders." Place the "Orders" subform in the dialog you just
created. Name the subform Sf_Orders. Relate the Parent and Child
information as P: CustID C: Order_FK_CustID.
Now find the On Current Event in the properties dialog. Place an [Event
Procedure]. Open it and write the following code.
Private Sub Form_Current()
Me.Sf_Orders.Requery
End Sub
Now, looking back at your customers form, you will write an open form
command like this:
DoCmd.OpenForm "Orders", , , "CustomerID=" & Me.CustomerID
This will open the CustomerOrders form to the current customer. If your
customer has existing orders, they will appear in the Sf_Orders subform. If
not, you can now enter an order and it will use the current customerID to
relate the order record automatically.
I hope this dosesn't confuse you. Good luck