-
Query Criteria
Hello -
I have what should be a simple adjustment that I need to make.
Here is the query that I am running:
SELECT
ContactMessage.InvoiceNumber,
ContactMessage.AIdent,
ContactMessage.OrderID,
ContactMessage.CustName,
ContactMessage.Message,
ContactMessage.Date,
ContactMessage.ContName,
ContactMessage.RepName,
ContactMessage.EmpName,
ContactMessage.CustomerID,
ContactMessage.Action
FROM contact
INNER JOIN
ContactMessage ON contact.ID = ContactMessage.ID
WHERE
(((ContactMessage.Date) Between getstartdate() And getenddate()) AND ((ContactMessage.RepName) Like [Please enter RepName or enter "*" for all]));
the problem is when ContactMessage.ContName is empty it doesn't return the row?
I'm coming from a MySQL background but I don't see why it is doing this. Can anyone shine some light on this?
Thanks in advance.
-
Code:
WHERE
(((ContactMessage.Date) Between getstartdate() And getenddate())
AND
((ContactMessage.RepName) Like [Please enter RepName or enter "*" for all]));
Since ContactMessage.ContName is not used in the Where clause, did you really mean the ContactMessage.RepName
If you rally men ContactMessage.RepName then try using the BZ () function with the field:
Nz(ContactMessage.RepName,"")
Like this:
Code:
WHERE
(((ContactMessage.Date) Between getstartdate() And getenddate())
AND
((Nz(ContactMessage.RepName,"")) Like [Please enter RepName or enter "*" for all]));
-
Thanks for your reply.
I did actually mean the ContName that is what makes the results weird for the query.
Any ideas?