Hello,
I'm having a problem with DLookup (I think that’s what I need to be using).
In capturing the users windows name in a separate function and storing it as ‘User’.
I want then to match the ‘User’ name against a table to return the full name of the person.
When I use the below I get Runtime 2471 the expression you entered as a query parameter produced this error: ‘MyWindowsUserName’.
NB MyWindowsUserName has replace my actual windows user name.
Thanks for any advice.
In table ‘tbl_User’, ‘UserID’ is the windows name, ‘Name’ is the full name of the person.
PS – This is in Access 2007.
Thanks
I'm having a problem with DLookup (I think that’s what I need to be using).
In capturing the users windows name in a separate function and storing it as ‘User’.
I want then to match the ‘User’ name against a table to return the full name of the person.
When I use the below I get Runtime 2471 the expression you entered as a query parameter produced this error: ‘MyWindowsUserName’.
NB MyWindowsUserName has replace my actual windows user name.
Thanks for any advice.
Code:
[SIZE=3][COLOR=#000080][FONT=Arial]Private Sub Command0_Click()[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000080][FONT=Arial]Call User [/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000080][FONT=Arial]Dim MyID As String[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000080][FONT=Arial]MyID = DLookup("Name", "tbl_User", "[UserID] =" & User())[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000080][FONT=Arial]Me.Text1 = MyID[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000080][FONT=Arial]End Sub[/FONT][/COLOR][/SIZE]
In table ‘tbl_User’, ‘UserID’ is the windows name, ‘Name’ is the full name of the person.
PS – This is in Access 2007.
Thanks