Creating Public Function

marcuscoker

Registered User.
Local time
Yesterday, 20:56
Joined
Sep 28, 2005
Messages
49
Hi

I have a query in Access and have the following expression

Quarter: ((DatePart("q",[DateEntered])+2) Mod 4)+1

To workout the Quarters (UK style) for financial years. I would like to have this as a public function that I could just call like the DatePart() function. Please could anybody help me to get started with this?

Thank you

Marcus
 
Something like this...
Code:
Public Function Quarter(nQuarter As Date)

Quarter = (DatePart("q", [nQuarter]) + 2) Mod 4 + 1
MsgBox Quarter 'display value just for the test

End Function
Then you would call it like this...
Code:
Call Quarter(Now) 'I used Now() just for the test
 
Thanks

Hi

Thanks for your help, that worked just as I needed

Thanks

Marcus
 

Users who are viewing this thread

Back
Top Bottom