Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Still Having Date problems

Status
Not open for further replies.

sinistapenguin

Technical User
Jan 21, 2004
31
GB
I am still having problems retrieving records that are between 2 dates!

This is what I have done:
====================================================

SELECT *
FROM Invoices
WHERE InvoiceDate BETWEEN 'varStartDate' AND 'varEndDate'
ORDER BY InvoiceDate

VARIABLES:

varStartDate 1 Request.form("StartDate")
varEndDate 1 Request.form("EndDate")

====================================================

I have also tried:

SELECT *
FROM Invoices
WHERE InvoiceDate > 'varStartDate' AND InvoiceDate < 'varEndDate'
ORDER BY InvoiceDate

I cannot seem to get this to work properly. If anyone has any ideas, they would be gratefully received.

Thanks

Sinista
 
SELECT *
FROM Invoices
WHERE InvoiceDate BETWEEN '#varStartDate#' AND '#varEndDate#'
ORDER BY InvoiceDate

[wink]

Cheech


[Peace][Pipe]
 
Hi Cheech

Sorry, small syntax error in my original post.

The dates are saved as Date format in access, so when I use '#varStartDate#' I get a data type mismatch, but if I use #varStartDate# I get a syntax error!

Any ideas?

Cheers
 
I use this select statement on an access database where datefields are defined as dates

"SELECT * FROM tblProducts WHERE fldIntent BETWEEN #" & strPreviousFirstDay & "# AND #" & strPreviousLastDay & "# ORDER BY fldAgreed, fldIntent DESC"

[Peace][Pipe]
 
Cheech

Are you putting this straight into the code or using the DMX recordset query?

Cheers
 
it is the same....click on "advanced view" and paste it
then below u declare & Request your variable
sin.jpg

(temp image)
All the best!

> need more info?
:: don't click HERE ::
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top