A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Ask the user to select report parameters



 
 
Thread Tools Display Modes
  #1  
Old April 15th, 2009, 09:52 AM posted to microsoft.public.access.reports
Dominic
external usenet poster
 
Posts: 31
Default Ask the user to select report parameters

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
  #2  
Old April 15th, 2009, 03:45 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Ask the user to select report parameters

Dominic wrote:
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\#")

--
Marsh
MVP [MS Access]
  #3  
Old April 15th, 2009, 04:22 PM posted to microsoft.public.access.reports
Dominic
external usenet poster
 
Posts: 31
Default Ask the user to select report parameters

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" wrote:

Dominic wrote:
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\#")

--
Marsh
MVP [MS Access]

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:35 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.