By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,290 Members | 1,761 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,290 IT Pros & Developers. It's quick & easy.

Month Parameter Report

P: 55
Please help me with a parameter report that allows one to input a month in words i.e. May, and displays values for that particular month only.

Regards,
May 8 '09 #1
Share this Question
Share on Google+
5 Replies


NeoPa
Expert Mod 15k+
P: 31,707
Where do you want help?
May 8 '09 #2

P: 55
All I am trying to know for now is the logic of how I can go about creating a date parameter report that asks for a month in words (as a drop down list) and on selecting the particular month e.g. May, data related to the month (e.g. anything with 05) will be returned.

Please help.....
May 8 '09 #3

NeoPa
Expert Mod 15k+
P: 31,707
That makes more sense to me :)

Form
Design with a control to select your month on, and a control (possibly Command Button) that triggers running the report.

Report
Design bound to a query. The design should be to allow all records to show. We will deal with filtering for the desired range in the code.

Code
Behind the Command button. This will invoke the report (DoCmd.OpenReport) but will pass a filter string in the call.

The string will be created in the code, similar to the following :
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdButton_Click()
  2.     Dim strFilter as string
  3.     Dim datStart As Date, datEnd As Date
  4.  
  5.     datMonth = CDate(Me.txtMonth)
  6.     datEnd = DateAdd("m", 1, datStart) - 1
  7.     strFilter = "[DateField] Between " & _
  8.                 Format(datStart, "\#d/m/yyyy\#") & _
  9.                 " And " & _
  10.                 Format(datEnd, "\#d/m/yyyy\#")
  11.     Call DoCmd.OpenReport(ReportName:="YourReport", _
  12.                           WhereCondition:=strFilter)
  13. End Sub
May 8 '09 #4

P: 55
Thanks a lot. Will tell you on my progress so let me try implementing it this way.
May 11 '09 #5

NeoPa
Expert Mod 15k+
P: 31,707
Let us know if you have any trouble with that.
May 13 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.