i am using Access97.
i have an SQL statement with two conditions for the WHERE clause and i am having trouble with the syntax.
this is what i have tried:
"where [RevisionDate] between " & Forms![frmForm1]![txtStartDate] & " And " & Format([Forms]![frmForm1]![txtEndDate], "short date" & " and " & "city= " & Forms![frmForm1]![cboCity].Column(1)
but with my MsgBox rec.RecordCount, i get 'no records found' even though i know there are records.
RevisionDate is a date field
TxtStartDate is an unbound text box with a format of Short Date.
txtEndDate is an unbound text box with a format of General Date and an input mask of 99/99/00" 11":"58":"58 PM";0;_ The input mask means it adds 11:58:58 to the date. (that way i am ensured of having all records on the date requested. for example, before, if i had a record with a date of 06/30/01 2:45:00pm and a user wanted to see all records between 01/01/01 and 06/30/01, that record wouldn't be included. but now that i changed it to show 06/30/01 11:58:58, that record would be included.)
The city part of the Where clause works by itself. so if my WHERE clause is just "where city= " & Forms![frmRptKPI]![cboCity].Column(1) it works pefectly.
so i need help with the Between And for a date field.
Thanks,
ruth
ruth.jonkman@wcom.com
i have an SQL statement with two conditions for the WHERE clause and i am having trouble with the syntax.
this is what i have tried:
"where [RevisionDate] between " & Forms![frmForm1]![txtStartDate] & " And " & Format([Forms]![frmForm1]![txtEndDate], "short date" & " and " & "city= " & Forms![frmForm1]![cboCity].Column(1)
but with my MsgBox rec.RecordCount, i get 'no records found' even though i know there are records.
RevisionDate is a date field
TxtStartDate is an unbound text box with a format of Short Date.
txtEndDate is an unbound text box with a format of General Date and an input mask of 99/99/00" 11":"58":"58 PM";0;_ The input mask means it adds 11:58:58 to the date. (that way i am ensured of having all records on the date requested. for example, before, if i had a record with a date of 06/30/01 2:45:00pm and a user wanted to see all records between 01/01/01 and 06/30/01, that record wouldn't be included. but now that i changed it to show 06/30/01 11:58:58, that record would be included.)
The city part of the Where clause works by itself. so if my WHERE clause is just "where city= " & Forms![frmRptKPI]![cboCity].Column(1) it works pefectly.
so i need help with the Between And for a date field.
Thanks,
ruth
ruth.jonkman@wcom.com