Are you sure that your UserID field is a text field and not a numeric field?
Or.. is there an entry for your username in the table? This code is pretty
rough, it won't handle missing names nicely. That's something that will have
to be dealt with, and could be your problem here.. although I would think it
should be some invalid use of null error.
:
Thank you for your help!!!
I am putting the code in the onload of the splash form and I get a type
mismatch error
If DLookup("[User_Type]", "[tblVersion]", "[UserID] = '" &
Environ("username") & "'") Then
Me.btnAdmin.Visible = True
Else
Me.btnAdmin.Visible = False
End If
--
deb
:
if DLookup("[User_Type]", "[tblVersion]", "[UserID] = '" &
Environ("username") & "'") then
me.btnAdmin.visible = true
else
me.btnAdmin.visible = false
end if
You can also use the same basic approach to display your user name:
me("name_display_control") = DLookup("[FullName]", "[tblVersion]", "[UserID]
= '" & Environ("username") & "'")
:
Yes they are the same.
--
deb
:
Is the UserID entry for a user the same as their environment username?
:
It uses Environ("username") to collect username and verify against the
tblVersion (see below)
I have a table (tblVersion) with the following fields:
UserID, FullName, and User_Type
mousm, Mickey Mouse, Admin
bman, Clark Kent, User
spman, Spider Man, User
How can I use Environ("username") to check against tblVersion to see if
User_Type is User and make button invisible?
Thanks in advance
--
deb
:
make the button invisible during design time.. then in the form load event do
a check to see if the user is an admin, if they are set the button visible to
true.
If you give a few details on how your users log in and the setup of your
roles table.. and we can probably throw the code together to do that for you
pretty quickly.
:
I need a couple of tweeks to my splash form...
1. I would like to display the FullName of the user logged in on the
Splashform. The Fullname and the login ID is listed in the table
(tblVersion).
2. There is a button that should not be visible if the user logged in has
the User_type of "User" and should be visible if the User_Type is Admin. The
button is called "btnAdmin" .
How can I accomplish this? I need this desperately!!
I have a table (tblVersion) with the following fields:
UserID, FullName, and User_Type
mousm, Mickey Mouse, Admin
bman, Clark Kent, User
spman, Spider Man, User