View Full Version : My other question about related forms


Romulus
03-04-2002, 11:18 AM
I have two forms that are set up as follows. The user can open the first form via the switchboard. The first form has a button which takes the user to the second form (this is the only way to get to the second form).

Anyhow, the user has the ability to select a person by their ID number on the first form. What I want is for that same person and all of their information to appear in the second form.

What happens now is that they are seemingly independent. I can select any ID on the first form and it has no affect on the second form. I tried using the following code:

Forms!frmSecond!ID.Value = Forms!frmFirstForm!ID.Value

but that did nothing, and I am guessing that this will not help populate the text boxes for that ID.

Any help is appreciated.

SimonC
03-04-2002, 11:40 AM
What you need is some way of restricting the information that appears on frmSecond.

A couple of ideas:

In form one, open form two like this:

DoCmd.OpenForm "frmSecond",,,"ID=" & Me!ID

Or make the record source for frmSecond into a query (if it isn't already) and include a WHERE clause in the query along the lines of

WHERE ID=[Forms]![frmFirstform]![ID]

Simon.

Jack Cowley
03-04-2002, 11:42 AM
Create the command button to open the second form using the Wizard. One of the questions will be if you want to open the form to a specific record. Select that option and then follow the rest of the screens.