Ask the user to select report parameters

D

Dominic

Hi all

I used to be able to do this, but have lost all the Access knowledge I once
had through lack of use.

I have a table (plus query, plus form) of staff absences and I want to
report on staff absences over a certain period. When I choose the report I
want to be asked the start date and end date of the report.

How do I do it again? I used to know all this ... :-(

Thanks for reading.

Dominic
 
M

Marshall Barton

Dominic said:
I used to be able to do this, but have lost all the Access knowledge I once
had through lack of use.

I have a table (plus query, plus form) of staff absences and I want to
report on staff absences over a certain period. When I choose the report I
want to be asked the start date and end date of the report.


That is really a crude way to do things, you can just set
the date field's criteria to something like:

Between [Enter start date] And [Enter end date]

Way better would be to use a form with two text boxes for
the dates and a button to do open the report. With this
approach, the code behind the button would use the
OpenReport method's WhereCondition argument to filter the
report. Then code could be something like:

strWhere = "[the date field] Between " & Format(txtStart,
"\#yyyy-m-d\#") & " And " & Format(txtEnd, "\#yyyy-m-d\#")
 
D

Dominic

Hi Marshall

That's great. I will use the "crude" way for now, but using the fancy form
sounds like a great idea and is definitely the way to go.

Thanks for the tips and your time.

Dominic


Marshall Barton said:
Dominic said:
I used to be able to do this, but have lost all the Access knowledge I once
had through lack of use.

I have a table (plus query, plus form) of staff absences and I want to
report on staff absences over a certain period. When I choose the report I
want to be asked the start date and end date of the report.


That is really a crude way to do things, you can just set
the date field's criteria to something like:

Between [Enter start date] And [Enter end date]

Way better would be to use a form with two text boxes for
the dates and a button to do open the report. With this
approach, the code behind the button would use the
OpenReport method's WhereCondition argument to filter the
report. Then code could be something like:

strWhere = "[the date field] Between " & Format(txtStart,
"\#yyyy-m-d\#") & " And " & Format(txtEnd, "\#yyyy-m-d\#")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top