Fog Creek Software
Discussion Board

Creating Date Parameter Query

Hi, May I ask how to create  a parameter query in ms access where a start date and end date is prompt to the user.  There is an existing date field in the table.  Thanks.

Sunday, May 16, 2004

Step 1.  Attend School.
Step 2.  Learn.
Step 3.  ...
Step 4.  ......
Step 5.  .........
Step 6.  Miller Genuine Draft
Step 7.  Read Help File
Step 8.  ...
Step 9.  World Peace
Step X.  Profit.

Sunday, May 16, 2004

People these days are such assholes. A man asks a simple question and instead of a straightforward answer he is told to go buy some MGD!

As we all know, Guinness helps the mind work.

Anon to protect the guilty
Monday, May 17, 2004

Investigate the '?' in Access and search Access help for parameterized queries.

Simon Lucy
Monday, May 17, 2004

You would be much better of to ask this question in one of the Microsoft newsgroups. In fact, those newsgroups on ms-access alone answer about 30,000 to 45,000 questions on JUST ms-access alone in one month…..and most questions are answer in less then 1 hour.

However, I will give some advise here!

You likely want to send the results of the query somewhere…(likely a report).

So, my suggestion to NOT use a parameters query..but simply pass a “where” clause to the OpenReprot. So, just build a nice prompt form to get the start/end date..and then the code to launch the report can  be:

Dim strWhere          as string

strWhere = “YourDateField between #” & format(me!txtStartDate,”mm/dd/yyyy”) & “#” & _
                    “ and #” & format(me!txtEndDate,”mm/dd/yyyy”) & “#”

Docmd.OpenReport “yourReprot”,acViewpreview,,strWhere

You can see some nice screen shots of some screens that use the above idea here:

Good luck…and if you need a good place for answers…try the Microsoft newsgroups. (a web interface is availing here if you wish).

Albert D. Kallal
Edmonton, Alberta Canada

Albert D. Kallal
Monday, May 17, 2004

*  Recent Topics

*  Fog Creek Home