Creating a parameter of type date for Access database

Stimulsoft Reports.NET discussion
Post Reply
fuhrj
Posts: 120
Joined: Wed Jun 11, 2008 12:51 pm
Location: Lancaster, Ohio

Creating a parameter of type date for Access database

Post by fuhrj »

When using an Access database via OleDB, how does one create a date parameter?

For example:

SELECT * FROM tblCustomer WHERE purchaseDate >= @startDate

To do this in Access, the query would look like this:

SELECT * FROM tblCustomer WHERE purchaseDate >= #7/1/2011#

Dates are wrapped with the hash tag. If I try to do this in Designer, I get a syntax error.

SELECT * FROM tblCustomer WHERE purchaseDate >= #@startDate#

If I leave the hash tags off, I get the error "Data type mismatch in criteria expression.". The @startDate parameter is set to DBDate.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Creating a parameter of type date for Access database

Post by Alex K. »

Hello,

You can use the following query in designer:

Code: Select all

SELECT * FROM tblCustomer WHERE purchaseDate >= ?
and add the @startDate parameter in datasource.
Please see the sample in attachment.

Thank you.
Attachments
1178.SampleReport.mrt
(7.77 KiB) Downloaded 211 times
Post Reply