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
TDOB = Me!DOB
DoCmd.OpenForm "Persons", , , "[LastName] = '" & Me.LastName & "' AND [FirstName] = '" & Me.FirstName & "'"
Me!LastName = Tlastname
Me!FirstName = Tfirstname
Me!Middle = Tmiddle
Me!DOB = TDOB
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.