Report grouping on specific dates

gray8015

Registered User.
Local time
Today, 13:34
Joined
Jul 26, 2010
Messages
10
I'm a bit new to this...
I'm working on a rugby database listing all games played for the last 150 years. I need to be able to group the report on all games played in a season but the season runs from June 1 through May 31.
I can't find any way to specify the start date of a group. (I just need to change January 1 to June 1.)
Hope this makes sense. Any ideas?
Thanks in advance for your help.
Kind regards...
 
The "best" way is to make a function I think:
Something like so....
Code:
 Function GameSeason(GameDate As Date) As String
    If Month(GameDate) < 6 Then
        GameSeason = Year(GameDate) - 1 & "-" & Year(GameDate)
    Else
        GameSeason = Year(GameDate) & "-" & Year(GameDate) + 1
    End If
End Function

If you are however stuck to the "(I just need to change January 1 to June 1.)"
Then try looking into the DateAdd Funciton.
 
Sorry to be a pain, but...
I've looked up DateAdd in the Help menu, but where do I use it? There is no place in the grouping dialog box to change the standard options?
I've not done any coding so I'm not sure how/where to "make a function" either!
I'm probably over my head with this stuff, but keen to learn how it all works.
Thanks for your patience...
 
You make a function by RTFM...

Anyhow...
To create that function above
1) Click on the Modules tab of the database
2) Click New
3) In the popped up screen, select Tools > Options
4) Check the "Require Variable Declaration" option (make sure it is checked)
5) Click OK
6) Paste the code I gave your earlier

Now you have created the function

Now to use it in the query you can use any function by creating it as a 'field'
So in the top line of query design you type:
Season: GameSeason(YourGameDate)

That calls the function to execute it...

I hope that was clear enough... Good hunting :)
 

Users who are viewing this thread

Back
Top Bottom