B
Boetie
Guest
I am currently developing a benefit logging system for the guys at work.
On entry into the system the user must login using his/her windows NT logon ID. This ID are the same as an ID in my DB's user table with a password in the table against their respective ID, in the user table are a auto number ID field which I use as a lookup number in other tables.
With the attached code I am able to pick up the user network ID and I am trying to look it up in the user table in order to pick up the auto number ID that is the value being remembered in the "Select User Logon Name, please :" dropdown box.
I want to use this value to set the default value in the drop down box and in other forms, but I keep on getting the following message as per screen dump.
I suspect that the string type is different because the value I am looking for is in the table under the right field. Can someone please help me.
Thanks
P.S. The code I am using is :
Function fOSUserName() As String
On Error GoTo fSOUserName_Err
Dim IngLen As Long
Dim IngX As Long
Dim strUserName As String
Dim strUserName1 As String
strUserName = String(254, 0)
IngLen = 255
IngX = apiGetUserName(strUserName, IngLen)
If IngX <> 0 Then
'StrConv(string, conversion, LCID)
strUserName = StrConv((Trim(Left(strUserName, IngLen - 1))), vbLowerCase)
strUserID = DLookup("[User_Detail_ID]", "Ltbl_User_Detail", _
"[User_Login_Name]= " & strUserName)
fOSUserName = strUserID
Else
fOSUserName = 0
End If
fSOUserName_Exit:
Exit Function
fSOUserName_Err:
MsgBox Error$
Resume fSOUserName_Exit
End Function
On entry into the system the user must login using his/her windows NT logon ID. This ID are the same as an ID in my DB's user table with a password in the table against their respective ID, in the user table are a auto number ID field which I use as a lookup number in other tables.
With the attached code I am able to pick up the user network ID and I am trying to look it up in the user table in order to pick up the auto number ID that is the value being remembered in the "Select User Logon Name, please :" dropdown box.
I want to use this value to set the default value in the drop down box and in other forms, but I keep on getting the following message as per screen dump.
I suspect that the string type is different because the value I am looking for is in the table under the right field. Can someone please help me.
Thanks
P.S. The code I am using is :
Function fOSUserName() As String
On Error GoTo fSOUserName_Err
Dim IngLen As Long
Dim IngX As Long
Dim strUserName As String
Dim strUserName1 As String
strUserName = String(254, 0)
IngLen = 255
IngX = apiGetUserName(strUserName, IngLen)
If IngX <> 0 Then
'StrConv(string, conversion, LCID)
strUserName = StrConv((Trim(Left(strUserName, IngLen - 1))), vbLowerCase)
strUserID = DLookup("[User_Detail_ID]", "Ltbl_User_Detail", _
"[User_Login_Name]= " & strUserName)
fOSUserName = strUserID
Else
fOSUserName = 0
End If
fSOUserName_Exit:
Exit Function
fSOUserName_Err:
MsgBox Error$
Resume fSOUserName_Exit
End Function