I appreciate it has been a while since this reply. I have followed the
instructions but the filter part does not work. I used the open form wizzard
and it asks me to select the two fields that will match. My main form is
called CONTACTS and the pop up fomr is called SITE DETAIL. They are based on
two related tables of the saem names. The tables are linked with a
one-to-many relationship, the many being on the side of SITE DETAILS. The
join is from the Contacts table field ID (primary key) to the SITE DETAILS
field Customer ID.
The WHERE condition in the SITE DETAIL form is "[Customer ID]=" & [ID]
BUT when the pop up opens from the main form all the records show and not
just the rcord(s) matching the current open record on the main form. Can you
help please?
=Forms!MainFormName!ControlName........ This bit works fine! When I make a new record on the pop up it automatically inserts the current main form ID in the Customer ID field.
Also, you will want to add a line to the code that opens the popup form that
saves the record in the main form prior to opening the popup form.
Exactly waht line of code shoule I enter where?
Thanks
--
Regards, Jon
--
Regards, Jon
Rick Brandt said:
The WHERE argument of the OpenForm method would typically be used to open
the Popup form pre-filtered to the records you want to see. One of the
choices provided by the CommandButton wizard will even do this for you.
What is another issue is that this will not give you subform type behavior
for NEW records. You will need to use code or other means to cause new
records to be automatically related to the main form record in the
background. One easy way is to set the default value property of the
controls bound to the related fields to something like...
=Forms!MainFormName!ControlName
Also, you will want to add a line to the code that opens the popup form that
saves the record in the main form prior to opening the popup form.