Forum Discussion
Getting a field from another form
- Jun 03, 2021
Your code passes a SQL Select statement to the second form. You ONLY need to pass the appropriate fields for the person and for the recommendation.
In addition, the second line is redundant. Your first line opens the recommendations form already filtered to that person.
You can pass both filtering values in a single line, something like this.
SurID = DLookup ("SurID", "Surveys", "Survey.PersonID_fk = " & Me.PersonID)
DoCmd.OpenForm "Recommendations",,, "PersonID_fk = " & Me.PersonID & " AND SurveyID_FK = " & SurID
Your code passes a SQL Select statement to the second form. You ONLY need to pass the appropriate fields for the person and for the recommendation.
In addition, the second line is redundant. Your first line opens the recommendations form already filtered to that person.
You can pass both filtering values in a single line, something like this.
SurID = DLookup ("SurID", "Surveys", "Survey.PersonID_fk = " & Me.PersonID)
DoCmd.OpenForm "Recommendations",,, "PersonID_fk = " & Me.PersonID & " AND SurveyID_FK = " & SurID
- ebentonJun 03, 2021Copper Contributor
George,
This worked perfectly. Thank you so much for taking the time to help me out.
Cheers,
Ebenton
- George_HepworthJun 03, 2021Silver ContributorCongratulations on solving the problem.
Continued success with your project.