Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Using DLookup

Status
Not open for further replies.

JimMc

Technical User
Sep 28, 2000
3
GB
I have created a table called 'users', this contains user name and the group which they belong to. I am attempting to get the database to check what group the current user belongs to, in order to set permissions for that user.

The problem I am having is the code works fine on one PC and when you attempt to run the application on another the DLookup function appears to fail and it will return the 'UserGroup variable = ""'. The User details appear to be fine.

***********************************************************

UserName = Environ$("username")
UserGroup = DLookup("[Group]", "UserDetails", "[User] = '" & UserName & "'")

***********************************************************

Any help would be greatly appreciated.
 
Make sure the Environ function is returning the expected result. If the "username" variable can't be found, Environ will return a zero-length string, which could be causing your problem. --------------
A little knowledge is a dangerous thing.
 
I know this sounds elementary but, make sure that the machine on which it will not work has the associated library file. You can get the name of the file in the "References". Then check to insure that the library file is installed. I had this same problem and that was our fix.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top