Open form if conditions are met

  • Thread starter Thread starter Tara
  • Start date Start date
T

Tara

I have a Login form and have set up an append query to capture the user name
from the form and save it to tblUser and a delete query to delete the record
when the db closes. Currently, once the user logs in and the Login form
closes, it's On Close event fires and causes another form (frmPreResponse) to
open. However, I want to make this form open ONLY if the userID in tblUser is
a certain ID (the supervisor's ID). Otherwise I want it skip opening this
form and open the main Switchboard instead. How would I begin to code this?
 
Go into the On close event and add an if then statement

txtUser = dlookup("user field name","tblUser","Optional" any condition you
need to get the correct record")
if txtUser="Supervisor" then
docmd.openform .........................etc or runmacro however the
form is called now
endif
 
Back
Top