Open form if conditions are met

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?
 
C

Chegu Tom

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
 

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