Button to open a new form using current ID

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
 
F

fredg

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] & """"
 

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

Top