Using Access 2007, I have a form with 3 buttons. The OnClick event sets a global variable and each of them opens another form whose record source is the following query.
The function CurrentTraining Type returns the value of the global variable set in the OnClick event procedure.
Instead of getting only 1 prompt when any of the buttons is clicked, based on that variable, the query prompts for all 3.
Any ideas how to rectify?
Code:
SELECT <several fields here> FROM ([tblEmployee Information] INNER JOIN [tblEmployee Training] ON [tblEmployee Information].ID=[tblEmployee Training].ID) INNER JOIN qryLawsonQueryByArea ON [tblEmployee Information].ID=qryLawsonQueryByArea.ID WHERE Iif(CurrentTrainingType()=1,(qryLawsonQueryByArea.[Next First Aid/CPR]<=Date()+[How Many Days Out?]),Iif(CurrentTrainingType()=2,(qryLawsonQueryByArea.[Next Recert]<=Date()+[How Many Days Out?]),(Date()+[How Many Days Out?]))) ORDER BY qryLawsonQueryByArea.Name;
Instead of getting only 1 prompt when any of the buttons is clicked, based on that variable, the query prompts for all 3.
Any ideas how to rectify?
Comment