Button to open a new form using current ID

  • Thread starter Thread starter David McLean
  • Start date Start date
D

David McLean

Hi there,

I've got a form that shows the results of student workplacements, and one of
the fields gives the Employer name. I have button that opens another form
which has contacti nformation for the employer, but I'm having trouble
getting it to open the new form to the current employer. Any ideas?

Thanks
David
 
Hi there,

I've got a form that shows the results of student workplacements, and one of
the fields gives the Employer name. I have button that opens another form
which has contacti nformation for the employer, but I'm having trouble
getting it to open the new form to the current employer. Any ideas?

Thanks
David

You may be displaying the Employer Name on this form, but I hope there
is a unique Prime Key EmployeeID field on your form and in the table.

Code a command button click event on Form1 to open Form2:

DoCmd.OpenForm "Form2", , , "[EmployeeID] = " & Me.[EmployeeID]

The above assumes [EmployeeID] is a Number datatype.
If it is Text, then use:
"[EmployeeID] = """ & Me.[EmployeeID] & """"
 
Back
Top