Module to open form based on User ID

M

Mary

I need a refresher on how to set up a module so it opens to a specific form
based on the User. The MS Access 97 db is secure, users log on with User ID
and password. I had an old db set up to open to a specific form based on the
User, but can't remember how I did it!

Also, is it possible to secure the database so that users cannot see each
others data? I want them to be able to view all of their reports, but not be
able to view co-workers reports.

Thanks, Mary
 
D

Douglas J. Steele

You can create an AutoExec macro that calls a function.

The function would be something like:

Function OpenFirstForm()

Select Case CurrentUser
Case "Tom"
DoCmd.OpenForm "frmTomsFirstForm"
Case "Dick"
DoCmd.OpenForm "frmDicksFirstForm"
Case "Harry", "Mary"
DoCmd.OpenForm "frmAlternateFirstForm"
Case Else
MsgBox "I don't know who you are!"
End Select

End Function

For that matter, it's probably possible to do something like this directly
in the AutoExec macro itself, but I never use macros, so I can't help you!
 

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