Code for opening form based on value in subform sitting in another form

Hammy01

New member
Local time
Today, 10:15
Joined
Mar 8, 2007
Messages
3
Hi,

I have a form (A) which contains a Datasheet subform (B).
B is based on a query that get it's value from A (another type of Query by Form). I also have a button on A which when clicked would open Form (C) at the record that I selected in B
all the forms and subform all get their data from the same table CUSTOMER and the primary key is CUSTID
Does anyone know the code to put in the button to load the selected record from B into C.

Thanks in advance for your help
 
When you open a form, you can supply arguments to it.
The third argument is a WHERE clause that is a valid
SQL statement but without using WHERE.

This should allow you to open form C containing
only the record you selected in form B.

Look in Access Help to learn more about a form's open
arguments.

e.g.

Docmd.OpenForm "FormC" , , , "CustName = '" & forms!formB!CustName & "'"

Supplying arguments is pretty tricky. You might have to experiment to
get the right syntax.
 

Users who are viewing this thread

Back
Top Bottom