Hi,
I have a networked database used by 30-40 people and I want to make it detect who is using the database when they log-in. I have the following code that returns the userID in a message box:-
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function UserID()
Dim Fred As String * 255
Dim UserID
GetUserName Fred, 255
UserID = Fred
MsgBox UserID
End Function
I want to use the value "UserID" to automatically select a user name from a droplist. I have tried calling the function from the "Start" form, that contains the droplist of users and it highlights the correct user in the list but unless I then select from the list manually, it doesn't seem to recognise the UserID.
I hope this is clear, I fear it's not but any help on this would be very much appreciated. Thanks
I have a networked database used by 30-40 people and I want to make it detect who is using the database when they log-in. I have the following code that returns the userID in a message box:-
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function UserID()
Dim Fred As String * 255
Dim UserID
GetUserName Fred, 255
UserID = Fred
MsgBox UserID
End Function
I want to use the value "UserID" to automatically select a user name from a droplist. I have tried calling the function from the "Start" form, that contains the droplist of users and it highlights the correct user in the list but unless I then select from the list manually, it doesn't seem to recognise the UserID.
I hope this is clear, I fear it's not but any help on this would be very much appreciated. Thanks