Inserting values in a subform

B

Bob Richardson

How can I insert values into some fields of a subform.

In the typical Customer-Order-Item situation, when the user wants to enter a
new Order I want to be sure that it's an order for the customer shown in the
main form. Likewise, when I add a new item to the order, I need to be sure
the customer and order numbers are transferred to the Item record. In my
arrangement, I have a main form with a subform that holds another subform (a
datasheet for all the items on the order).
 
M

[MVP] S.Clark

Please examine the Northwind database, and feel free to post how your needs
differ from that solution.

I think the answer is the fact that the Link Child Fields and Link Master
Fields should do the work for you between the Main and Subform, but if not,
you can always execute a SQL statement in code to append a record to the
table.

e.g.
currentdb.execute "Insert Into TableName ...
 
B

Bob Richardson

Looking at the Northwind db I see that the Customer Orders Form is very
close to what I'm trying to do. My problem is, how do I bind the forms so
that when I click on an order in the datasheet view in the upper sub form,
it shows the detail for the order in the lower subform?
 
B

Bob Richardson

I have the Link Child fields at:
OrderNo

and the Link Master Field at
[Subform1].Form![OrderNo]

My Subform1 shows the correct orders in a dataview for the selected
customer. My subform2 shows the form corr3ectly, but all the data is blank.
Help!
 
Top