itipu
03-21-2010, 09:25 AM
I have a fairly complex query, in the end I just add a date range, i.e from - to based on the values of 2 drop down boxes, however its not displaying results correctly.. somehow it looks like it limits results to 2.. and if one is filled in and the other isn't it displays randoms dates... Database attached, would be much appreciated. You need to click RESET button first.
Thanks a lot
Mike
SQLStr = "SELECT Client.ClientID, Client.Title, Client.LastName, Client.DateOfBirth, Client.FirstName, Client.MaritalStatus, Client.City, Client.Country " & _
"FROM Client " & _
"WHERE (((([MaritalStatus]=[Forms]![Main Form]![cboMaritalStatus] Or [Forms]![Main Form]![cboMaritalStatus] Is Null)=True) " & _
"AND (([City]=[Forms]![Main Form]![cboCity] Or [Forms]![Main Form]![cboCity] Is Null)=True) AND (([Country]=[Forms]![Main Form]![cboCountry] Or [Forms]![Main Form]![cboCountry] Is Null)=True) " & _
"BETWEEN (([DateOfBirth]=[Forms]![Main Form]![cboFrom] Or [Forms]![Main Form]![cboFrom] is Null)=True) AND (([DateOfBirth]=[Forms]![Main Form]![cboTo] Or [Forms]![Main Form]![cboTo] is Null)=True))"
Thanks a lot
Mike
SQLStr = "SELECT Client.ClientID, Client.Title, Client.LastName, Client.DateOfBirth, Client.FirstName, Client.MaritalStatus, Client.City, Client.Country " & _
"FROM Client " & _
"WHERE (((([MaritalStatus]=[Forms]![Main Form]![cboMaritalStatus] Or [Forms]![Main Form]![cboMaritalStatus] Is Null)=True) " & _
"AND (([City]=[Forms]![Main Form]![cboCity] Or [Forms]![Main Form]![cboCity] Is Null)=True) AND (([Country]=[Forms]![Main Form]![cboCountry] Or [Forms]![Main Form]![cboCountry] Is Null)=True) " & _
"BETWEEN (([DateOfBirth]=[Forms]![Main Form]![cboFrom] Or [Forms]![Main Form]![cboFrom] is Null)=True) AND (([DateOfBirth]=[Forms]![Main Form]![cboTo] Or [Forms]![Main Form]![cboTo] is Null)=True))"