Quarterly start and end dates

  • Thread starter gmazza via AccessMonster.com
  • Start date
G

gmazza via AccessMonster.com

Hi there,
I have a parameter report and I have 4 buttons, each button representing each
quarter.
I have 2 text fields on the form, one being a start date and one being an end
date.
When I click a button, say Q1, I need the Start Date to say: 01/01/2009 and
the End Date to say 31/03/2009
etc for all the rest of the buttons for each quarter.
What is the correct syntax for a quarter?
Thanks for your help!
 
K

KARL DEWEY

If you only need current year quarters then try this using option group
values 1 through 4 instead of buttons --
Quarter Start:
DateAdd("q",[Forms]![YourForm]![Frame0]-1,DateSerial(Year(Date()),1,1))

Quarter End:
DateAdd("q",[Forms]![YourForm]![Frame0],DateSerial(Year(Date()),1,1)-1)
 
G

gmazza via AccessMonster.com

My employer requires buttons for some reason.
The code would be different for a button, right?

KARL said:
If you only need current year quarters then try this using option group
values 1 through 4 instead of buttons --
Quarter Start:
DateAdd("q",[Forms]![YourForm]![Frame0]-1,DateSerial(Year(Date()),1,1))

Quarter End:
DateAdd("q",[Forms]![YourForm]![Frame0],DateSerial(Year(Date()),1,1)-1)
Hi there,
I have a parameter report and I have 4 buttons, each button representing each
[quoted text clipped - 6 lines]
What is the correct syntax for a quarter?
Thanks for your help!
 
M

Marshall Barton

gmazza said:
Hi there,
I have a parameter report and I have 4 buttons, each button representing each
quarter.
I have 2 text fields on the form, one being a start date and one being an end
date.
When I click a button, say Q1, I need the Start Date to say: 01/01/2009 and
the End Date to say 31/03/2009
etc for all the rest of the buttons for each quarter.
What is the correct syntax for a quarter?


Try using the DateSerial function in the buttons' code. I
think the first quarter button's code would be like:

Me.txtStartDate = DateSerial(Year(date),1,1)
Me.txtEndDate = DateSerial(Year(date),4,0)
 
K

KARL DEWEY

An Option Group can display buttons, checkboxes, or toggle buttons - you
select which.

gmazza via AccessMonster.com said:
My employer requires buttons for some reason.
The code would be different for a button, right?

KARL said:
If you only need current year quarters then try this using option group
values 1 through 4 instead of buttons --
Quarter Start:
DateAdd("q",[Forms]![YourForm]![Frame0]-1,DateSerial(Year(Date()),1,1))

Quarter End:
DateAdd("q",[Forms]![YourForm]![Frame0],DateSerial(Year(Date()),1,1)-1)
Hi there,
I have a parameter report and I have 4 buttons, each button representing each
[quoted text clipped - 6 lines]
What is the correct syntax for a quarter?
Thanks for your help!
 
G

gmazza via AccessMonster.com

Worked perfect, thanks for the help guys!

Marshall said:
Hi there,
I have a parameter report and I have 4 buttons, each button representing each
[quoted text clipped - 5 lines]
etc for all the rest of the buttons for each quarter.
What is the correct syntax for a quarter?

Try using the DateSerial function in the buttons' code. I
think the first quarter button's code would be like:

Me.txtStartDate = DateSerial(Year(date),1,1)
Me.txtEndDate = DateSerial(Year(date),4,0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top