I'd suggest working out the <= date selection statement before addining the additional criteria perhaps with something like the following...
strSQL1 = "SELECT * FROM DatedMaterial " & _ "WHERE datediff(day, ViewUntil, GETDATE()) <= 0" |
The most common error using dates in MSSQL queries is invalid format on input dates The second common error is storing the dates in an invalid format to begin with. - e.g. MMDDYYYY is not a vaild date, MM-DD-YYYY is a valid date. You may want to run a query against the db to print some of the dates and make sure they're what you expect. If this proves to be the problem, check out the IsDate and CDate asp commands.
EDIT: A lot of people don't use date fields at all, they store dates as small text fields formatted as YYYYMMDD or YYYY-MM-DD.
Edited by dpyers