troubleshooting Question

Pass multiple arguments to open a form

Avatar of wiswalld
wiswalldFlag for United States of America asked on
Microsoft Access
3 Comments1 Solution1341 ViewsLast Modified:
I have a form(CAD) where I click to add a person. After clicking the button to add a person it opens a search form(personsearch) to see if that person already exists. After entering a last name and clicking a button a form opens(matchingnames) with a subform showing the matching last names in datasheet view. I double click the name in the subform(newpersonssubform1) to open a new form (persons) to a new record with the matching records.

I want the complaintnumber field from the CAD form to also carry over to the persons form when it is open. This is what is in the double click event of the subform.

Dim Tlastname, Tfirstname, Tmiddle, TDOB

Tlastname = Me!LastName
Tfirstname = Me!FirstName
Tmiddle = Me!Middle

DoCmd.OpenForm "Persons", , , "[LastName] = '" & Me.LastName & "' AND [FirstName] = '" & Me.FirstName & "'"
Me!LastName = Tlastname
Me!FirstName = Tfirstname
Me!Middle = Tmiddle

This works fine but I don't want them to have to enter a new complaint number on the "persons" form. It should come from the "CAD" form.

I am not sure if I understand opening the form based on multiple fields. I can get it to match one, two with help, but I do not understand how to add three or four or five.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros