Sub Showmethename()
Dim loguser As String
Dim uname As String
loguser = Environ("UserName")
MsgBox " This is the name " & (loguser)
uname = DLookup("Fullname", "tbl-Permissions", "LoginName= 'loguser'")
MsgBox (uname)
End Sub
why this does not work ?
the problen seen to be with the variable loguser ??? I dont know why
Lookup does not want to work
-
- Administrator
- Posts: 78620
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Lookup does not want to work
"LoginName= 'loguser'" is a literal, fixed string. It makes the code look for a user named literally loguser. You must place loguser outside the quotes:
Code: Select all
uname = DLookup("Fullname", "tbl-Permissions", "LoginName= '" & loguser & "'")
Best wishes,
Hans
Hans