I am starting a new project and I would like to use the AutoExec Macro for this one. I have the following function and when calling the function I keep getting the error "The expression you entered has a function name that Microsoft access can't find". Here is the function code
Do I need to reference something? I cannot figure it out.
The Macro is setup as RunCode - Function Name OpenCHeck()
Code:
Option Compare Database
Option Explicit
Public Function OpenCHeck()
Dim varUser
Dim varOK
varUser = Environ("username")
varOK = DLookup("[racfid]", "tbluser", "[racfid] = '" & varUser & "'")
If IsNull(varOK) Then
MsgBox "Get outa here loser", vbExclamation
DoCmd.Quit
End If
End Function
Do I need to reference something? I cannot figure it out.
The Macro is setup as RunCode - Function Name OpenCHeck()