R
requeth
I'm getting the error message:
"Compile error: Function call on left-hand side of assignment must
return Variant or Object"
I am attaching my module below, it is selecting the MsgBox line when I
choose ok after the error. I do not see anything wrong, but I have no
idea what the help file is talking about. Does anyone see what the
issue is?
Option Compare Database
Public Declare Function apiLogOut Lib "advapi32.dll" Alias
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function auditlog() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
Dim v_user As String
Dim Authorized As Boolean
Dim Authload
Dim strMsg
strUserName = String$(254, 0)
lngLen = 255
lngX = apiLogOut(strUserName, lngLen)
If lngX <> 0 Then
auditlog = Left$(strUserName, lngLen - 1)
Else
auditlog = "No ID"
End If
v_user = auditlog
Authload = "SELECT COUNT(*) FROM PTEAM WHERE FXID='" & v_user & "'"
DoCmd.SetWarnings False
DoCmd.RunSQL Authload
DoCmd.SetWarnings True
If Authload = 1 Then
Authorized = Yes
Else
Authorized = No
sqlInsertStatement = "Insert into
UserLog([UserName],[LoginDate],[LoginTime],[StatusType],[Authorized])
Values('" & v_user & "','" & Format(Date, "mm\/dd\/yyyy") & "','" &
Time & "','Logout','" & Authorized & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL sqlInsertStatement
DoCmd.SetWarnings True
If Authorized = No Then
strMsg = "Access is not permitted. Please speak with the process team
leader for further guidance."
MsgBox(strMsg, vbOKOnly, "Access Error") = _
vbOK
Private Sub AppExit_Click()
Application.Quit acPrompt
Else
DoCmd.OpenForm "MainMenu"
End Sub
"Compile error: Function call on left-hand side of assignment must
return Variant or Object"
I am attaching my module below, it is selecting the MsgBox line when I
choose ok after the error. I do not see anything wrong, but I have no
idea what the help file is talking about. Does anyone see what the
issue is?
Option Compare Database
Public Declare Function apiLogOut Lib "advapi32.dll" Alias
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function auditlog() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
Dim v_user As String
Dim Authorized As Boolean
Dim Authload
Dim strMsg
strUserName = String$(254, 0)
lngLen = 255
lngX = apiLogOut(strUserName, lngLen)
If lngX <> 0 Then
auditlog = Left$(strUserName, lngLen - 1)
Else
auditlog = "No ID"
End If
v_user = auditlog
Authload = "SELECT COUNT(*) FROM PTEAM WHERE FXID='" & v_user & "'"
DoCmd.SetWarnings False
DoCmd.RunSQL Authload
DoCmd.SetWarnings True
If Authload = 1 Then
Authorized = Yes
Else
Authorized = No
sqlInsertStatement = "Insert into
UserLog([UserName],[LoginDate],[LoginTime],[StatusType],[Authorized])
Values('" & v_user & "','" & Format(Date, "mm\/dd\/yyyy") & "','" &
Time & "','Logout','" & Authorized & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL sqlInsertStatement
DoCmd.SetWarnings True
If Authorized = No Then
strMsg = "Access is not permitted. Please speak with the process team
leader for further guidance."
MsgBox(strMsg, vbOKOnly, "Access Error") = _
vbOK
Private Sub AppExit_Click()
Application.Quit acPrompt
Else
DoCmd.OpenForm "MainMenu"
End Sub