Different switchboard displayed depending on user.

M

MCB

I have been given a database (it was created long before I arrived at the company, I am using Access 2000) that displays one switchboard when launched. There are eight functions listed on the switchboard. I have been asked split up the functions, so that team leads and above can access all eight functions, but regular users can only access one

I think this requires a module, either to retrieve the user's Windows login, or to display a message box requiring the person to login to determine which switchboard he/she sees. However, I have zero experience with VBA or building modules. I read the threads about "Startup with Conditional Views per User" and "Using Windows logon", and what they want to do makes sense, I just have no idea how to do this. Help?
 
N

Nikos Yannacopoulos

That's really funny, the only possible explanation I can think of is there
is nothing in the form name field for user "myname" in the table.

MCB said:
usernam = "myname", so that's fine, since I'm logged in on my own PC.

frm = "", so yeah, it's not finding what it's looking for. However, my
username is, indeed, in tblUserForms - it was the first username I entered,
and there's no typo. I even tried deleting all the others except that one,
no change in the error.
****************
What does the error mesage refer to? To identify it, change the code to:

Function Launch_User_Form()
Dim frm As String, usernam As String
usernam = Environ("UserName")
frm = DLookup("[fldForm]", "tblUserForms", "[fldUser] = ' " & usernam & " '
")
DoCmd.OpenForm frm
End Function

Then place the cursor somewhere in the function and execute step by step (by
hitting F8). Once the highlight reaches the DoCmd.OpenForm statement (which
means the previous one has executed), place and leave the cursor over the
usernam variable. If it shows the current username as a value then that part
is OK (I don't expect a problem here). Do the same with the frm variable. It
should show a form's name if everything OK, but my guess is you'll see a
"frm = Null". If this is the case, then it's because there is no record in
tblUserForms for the current user (typo?) so the DLookup returns a null
value.
 
M

MCB

Thanks for your attempts to help. I am going to try setting things up a totally different way. Wish me luck! :)
 
N

Nikos Yannacopoulos

OK then, good luck, but my offer still stands.

Nikos

MCB said:
Thanks for your attempts to help. I am going to try setting things up a
totally different way. Wish me luck! :)
 

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