linked forms

  • Thread starter Thread starter Simon
  • Start date Start date
S

Simon

Any ideas on the below?:

I have 2 forms, 1 with names (form1) and 1 with
information supplied (form2). Form2 holds information on
vaious documents that need to be supplied to people listed
in form1. What I want to be able to do is go to a users
record in form1 and click a button which brings up form2
and displays what documents have been sent to that
person. I can get the form to appear but all records are
there to navigate, not a single record that relates to the
person selected in form1.

Any help would be great!
Simon
 
You need to filter the second form by a unique field from the first form
that defines the user. You could make the second form a subform of the first
or continue the way you have it as a pop-up. In the DoCmd.OpenForm call,
pass the current user ID (or whatever your unique field is) in the Where
Condition parameter.

Example:

DoCmd.OpenForm "Form1",acNormal,,"[PersonID]=" & Me.txtPersonID
 
Presuming you have a control on each form which can be used as a "linking
field", the Command Button Wizard will do all this for you. If you want to
code this yourself, you would need to use something like the following in
the Click event of the command button on your Form1:

Dim strLinkCriteria As String

strLinkCriteria = "[PersonID]=" & Me![PersonID]
DoCmd.OpenForm "Form2", , , strLinkCriteria




hth,
 
Back
Top