datelastvisited field is not during the last 3 months
or is null
AND has a region matching a user input value
in a customercalls table with a one to many relationship on customerid
if nextcalldate is within the lst 3 months
or is null
i thought i had it working but its not..
below is the query that i thought was working before I tried adding the null criteria..
SELECT customers.*, customers.CustomerLastVisitDate, CustomerCalls.CustomerCallDateNext FROM customers INNER JOIN CustomerCalls ON customers.CustomerID = CustomerCalls.CustomerID WHERE ((([customers.customerregion])='" & Me.cboRegion & "') AND ([customers.CustomerLastVisitDate] Not Between Date() And DateAdd('m',-3,Date()))) AND ((CustomerCalls.CustomerCallDateNext) Between Date() And DateAdd('m',-3,Date())) OR (([customercalls.customercalldatenext])=Date());
I would isolate your problem by making two queries, one for each side of the OR.
Once you have each of those queries working to your satisfaction, you can just copy and paste the SQL statement together with OR