Morning all,
Please can someone tell me if its possible to use LIKE and a function as a query criteria?
My function is:
And my query is:
When I try as per above I get no results. If I add *User()* I get an invalid operator error.
I need to use LIKE as there may be multiple users in the PIC field.
Thanks
Please can someone tell me if its possible to use LIKE and a function as a query criteria?
My function is:
Code:
Public Function User()[/FONT][/COLOR]
[COLOR=#1f497d][FONT=Arial]User = VBA.Environ("UserName")[/FONT][/COLOR]
[COLOR=#1f497d][FONT=Arial]End Function
And my query is:
Code:
SELECT tbl_REF_Reminder.Type, tbl_REF_Reminder.PIC, tbl_REF_RMOPIC.[UN Code], tbl_REF_RMOPIC.[AG Code], tbl_REF_Reminder.Agent, tbl_REF_Reminder.DueDate, tbl_REF_Reminder.RemindStatus, tbl_REF_UID.UserID, tbl_REF_RMOPIC.[Agency Name] AS Agency[/FONT][/COLOR]
[COLOR=#1f497d][FONT=Arial]FROM (tbl_REF_Reminder INNER JOIN tbl_REF_RMOPIC ON tbl_REF_Reminder.Agent = tbl_REF_RMOPIC.[UN Code]) INNER JOIN tbl_REF_UID ON tbl_REF_RMOPIC.[PIC Name] = tbl_REF_UID.Name[/FONT][/COLOR]
[COLOR=#1f497d][FONT=Arial]WHERE (((tbl_REF_Reminder.PIC) Like User()) AND ((tbl_REF_Reminder.DueDate) Between Format(Now()-2,'dd/mm/yyyy') And Format(Now(),'dd/mm/yyyy')) AND ((tbl_REF_Reminder.RemindStatus)=-1));
When I try as per above I get no results. If I add *User()* I get an invalid operator error.
I need to use LIKE as there may be multiple users in the PIC field.
Thanks