Linking Forms

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?
 
B

Brian

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
 
W

wright305

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top