Linking Forms

  • Thread starter Thread starter wright305
  • Start date Start date
W

wright305

I created a database and I would like to link different forms together by
one field. For example, I have a witness table to list all of the witness
info, and would like to open another form with the same case number for the
suspect info. I'm new to this and don't know anything about vb so go easy..I
have created a subform on my main form which works great. I just need to open
new form from another table that will force the same case number. Any help?
 
Something like this. Put a button on your form called "ButtonSuspect". Make
its click event like this:

Private Sub ButtonSuspect_Click()
DoCmd.OpenForm "Suspect",acNormal,,"[CaseID] = " & CaseID
End Sub

The first "CaseID" refers to the CaseID field in the Suspect table; the
second one to the CaseID field in (presumably) a Case table and on the first
form. This filters the Suspect form to those Suspect having this CaseID.

Presumably, you have at least three tables:

Case
Witness
Suspect

because...you may have more than one witness and more than one suspect per
case.

Alternatively, if your main form is related to the case table, you can have
a subform for witnesses, linked by CaseID & another for suspects, also linked
by CaseID.
Post back
 
Thank you very much...I give this a try!

Brian said:
Something like this. Put a button on your form called "ButtonSuspect". Make
its click event like this:

Private Sub ButtonSuspect_Click()
DoCmd.OpenForm "Suspect",acNormal,,"[CaseID] = " & CaseID
End Sub

The first "CaseID" refers to the CaseID field in the Suspect table; the
second one to the CaseID field in (presumably) a Case table and on the first
form. This filters the Suspect form to those Suspect having this CaseID.

Presumably, you have at least three tables:

Case
Witness
Suspect

because...you may have more than one witness and more than one suspect per
case.

Alternatively, if your main form is related to the case table, you can have
a subform for witnesses, linked by CaseID & another for suspects, also linked
by CaseID.
Post back

wright305 said:
I created a database and I would like to link different forms together by
one field. For example, I have a witness table to list all of the witness
info, and would like to open another form with the same case number for the
suspect info. I'm new to this and don't know anything about vb so go easy..I
have created a subform on my main form which works great. I just need to open
new form from another table that will force the same case number. Any help?
 
Back
Top