I am having a problem with the WHERE clause when trying to open a form.
If I use
DoCmd.OpenForm "Appointments", , , "LeaderId = 34"
then it opens the form with the correct details but if I try to use a variable, as below
DoCmd.OpenForm "Appointments", , , "LeaderId = " & Leader
then I get the record but I do not get the name that is linked to the LeaderId record (the variable does contain valid data).
I know that this must be something to do with syntax but I cannot work out where I am going wrong - can anyone spot where I am going wrong?
David
Remember: You only know what you know
and - you don't know what you don't know!
If I use
DoCmd.OpenForm "Appointments", , , "LeaderId = 34"
then it opens the form with the correct details but if I try to use a variable, as below
DoCmd.OpenForm "Appointments", , , "LeaderId = " & Leader
then I get the record but I do not get the name that is linked to the LeaderId record (the variable does contain valid data).
I know that this must be something to do with syntax but I cannot work out where I am going wrong - can anyone spot where I am going wrong?
David
Remember: You only know what you know
and - you don't know what you don't know!