Ask the user to select report parameters

  • Thread starter Thread starter Dominic
  • Start date Start date
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
 
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\#")
 
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\#")
 
Back
Top