According to the first couple of google results, it appears that the saved
query part shouldn't have a problem.
Opening the query, and typing in the string as the criteria manually, the
query runs fine.
So, I'm at a loss. Here's my script:
Private Sub Auditor_Change()
Dim username As String
Dim phone As String
Dim site As String
' formula_user is the following query:
' SELECT tbl_user.User_ID, [User_First]+" "+IIf([User_MI] Is Null Or [User_MI]
="" Or [User_MI]=" "," ",[User_MI]+" ")+[User_Last] AS User_Name, tbl_user.
User_Site, tbl_user.User_Phone, tbl_user.Active_Employee
' FROM tbl_user;
username = Me.Auditor.Value
phone = DLookup("User_Phone", "formula_user", "Criteria = '" & username & "'")
site = DLookup("User_Site", "formula_user", "Criteria = '" & username & "'")
MsgBox "Name: " & username & vbNewLine _
& "Phone: " & phone & vbNewLine _
& "Site: " & site
End Sub
Dlookup("field","SAVED_QUERY","Criteria='string'")
I think it's not liking either using a saved query as a table, or it's not
liking that my string/date/number is a calculated expression in the query.
Thanks for your help.