Maybe I'm not getting it and still can't find an example of what I want to
do but I do remember seeing it done. Here is the exact code. I have
tried several variations of brackets etc so that The variable
"AuthFunction" is replaced in the IF statement with the value in the
variable.
************************************************************************************
Public Function checkAuth(Badge, AuthFunction) As String
Dim strsql, rtxx As String
Dim rst As Recordset
strsql = "SELECT authtocoll, "
strsql = strsql & "authtodel, "
strsql = strsql & "authtoMachine, "
strsql = strsql & "authtoadmin, "
strsql = strsql & "authoffhourentry, "
strsql = strsql & "authtomaint "
strsql = strsql & "FROM members WHERE MEMBERBADGENUMBER = " & Badge & ";"
Set rst = CurrentDb.OpenRecordset(strsql)
If rst.[Eval("AuthFunction")] <> True Then
rtxx = MsgBox("You are not authorized for this function",
vbCritical)
checkAuth = False
End If
rst.Close
End Function
******************************************************************************************
Sorry for lack of clarity, let me restate the issue. I want the
"statement"
to be modified and the variable name to be replaced with the variable
content. better example
strcompare = "screenName"
If strcompare = "ynot" then... This
statement would execute as :
If screenName = "ynot" then......
That is where I want the value of the variable to replace the variable
name.
I thought there were special characters to wrap the variable name in so
that
the name is replaced by the content... BUT I can't find it....
Check out the Eval() function ... this might be what you want.