subform info retrival

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 tables with a one-to-many relationship with a common uniqueID
connecting them. From the main table there is a main form with a command
button to open a second form. In the second, there is info from the main
form table (name, address, etc...) to help with identificaiton. I want the
second from to retrieve the uniqueID from the first form so it will grab the
rest of the info. How do I set form2 unique ID to be equal to form1 uniqueID?
 
Filter the second form to the current form's ID when you open it from the
button on the first form, e.g.

DoCmd.OpenForm "YourSecondForm", WhereCondition:= "UniqueID = " & Me.UniqueID

This assumes UniqueID is a number data type if its text you'd use the
following, wrapping the value in quotes:

DoCmd.OpenForm "YourSecondForm", WhereCondition:= "UniqueID = """&
Me.UniqueID & """"

Ken Sheridan
Stafford, England
 

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

Back
Top