I have a report that uses a query to pull data based on the user's name. Currently the report will prompt the user to enter in a name and then run the report based on that name.
I would like the user to be able to run a report with wild cards. Instead of typing "John Doe" to view all his records, I would like the user to be able to just type "John" and view all records with this name in it.
I tried using the following code, but it will not pull in any records unless the name is exact. DO I have my syntax wrong? I thing it is incorrect where it states "Like [Enter User Name]".
Thanks in advance!
SELECT Contacts.FieldOffice, Contacts.UserName, Calls.CallType, Calls.CallDate, Calls.CallTime, Calls.Subject, Calls.Notes, Company_T.COMPANY_NAME, Contacts.ContactID
FROM Contacts INNER JOIN (Calls LEFT JOIN Company_T ON Calls.ContactID = Company_T.COMPANY_NUMBER) ON Contacts.ContactID = Calls.ContactID
WHERE (((Contacts.UserName) Like [Enter User Name]));
I would like the user to be able to run a report with wild cards. Instead of typing "John Doe" to view all his records, I would like the user to be able to just type "John" and view all records with this name in it.
I tried using the following code, but it will not pull in any records unless the name is exact. DO I have my syntax wrong? I thing it is incorrect where it states "Like [Enter User Name]".
Thanks in advance!
SELECT Contacts.FieldOffice, Contacts.UserName, Calls.CallType, Calls.CallDate, Calls.CallTime, Calls.Subject, Calls.Notes, Company_T.COMPANY_NAME, Contacts.ContactID
FROM Contacts INNER JOIN (Calls LEFT JOIN Company_T ON Calls.ContactID = Company_T.COMPANY_NUMBER) ON Contacts.ContactID = Calls.ContactID
WHERE (((Contacts.UserName) Like [Enter User Name]));