Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Specific Month name in Report (2000)

    Someone has asked me to figure something out for them that I'm not sure what to do, here's the scenario in his database.

    There is a query called 'Monthly Count' that is a parameter query that is prompting the user to enter a start and end date, and then it's counting the number of records that were entered into the database based on those dates (it's counting on an admission date field). There is also a report called 'Monthly Count' that is taking those results and putting it into a pretty little report. However, on the report is a line that says 'Monthly Count for' and then it's currently displaying the current Month and year, but he wants it to display the month name and year that was entered in the parameter query. At first I had a hard time figuring out how it was even displaying that information, as the properties show that it's just a label. After looking around some more, I was able to find an event procedure that was running on the report itself when the report is opened:

    Option Compare Database

    Private Sub Report_Open(Cancel As Integer)
    Months.Caption = Format(Now, "mmmm yyyy")
    End Sub

    I am assuming that this VB event procedure is controlling the current month year on the report in that line. However, I don't know enough about visual basic to know how to modify that event to display the month that is involved in the query. Is it possible to do this? If not by modifying the code, is there another way to do what he's trying to do?

    Thanks in advance for the help.

    -Kelley

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Specific Month name in Report (2000)

    In the query, add a column and enter the following :
    CurDate: [...]
    Replace the 3 points with exact the same question as where the parameter is asked.
    You have now a field CurDate in you query that returns the answer to the parameter and you can use it in your report
    In the report you can format it like you want.
    Dot forget to remove the code in the on open event of the report.
    Francois

  3. #3
    Star Lounger
    Join Date
    Oct 2001
    Location
    Western Massachusetts, USA
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Specific Month name in Report (2000)

    You can do this right in the Report also. For example, if the parameter in your query reads
    Between [Enter Start Date] And [Enter End Date]
    in a Textbox on the Report you would put
    ="This Report is for " & Format([Enter Start Date],"mmmm/yyyy")
    You will not be prompted a second time.

    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •