Modify table at start up

  • Thread starter Thread starter Ken Ivins
  • Start date Start date
K

Ken Ivins

I have two tables with one record each. At start up I would one of them to
erase the current record and put in the first day of the up coming month.
The second table, I would like it to put in the first day on the next
quarter. How do I do that?

Thanks,
Ken Ivins
 
Hi Ken

The first day of the next month is given by:
DateSerial(Year(Date), Month(Date)+1, 1)

The first date of the next quarter is given by:
DateSerial(Year(Date), (Month(Date)-1)\3*3+4, 1)

You can store the results of these calculations in a table if you want to,
but I don't see the point when they can be calculated so easily on the fly.

--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand

Return mail address is invalid in a vain attempt to reduce spam.
Feedback is welcome at: (e-mail address removed)
Please post new questions or followups to newsgroup.
 
DateSerial(Year(Date), (Month(Date)-1)\3*3+4, 1)

You need one more parenthesis. Apparently the integer division (\) doesn't follow the
standard rule of division and multiplication from left to right. The multiplication is
being done first, causing a division by 9. (Access XP, I don't know if this is a problem
in other versions)

DateSerial(Year(Date), ((Month(Date)-1)\3)*3+4, 1)
 
You need one more parenthesis. Apparently the integer division (\) doesn't
follow the
standard rule of division and multiplication from left to right.

Thanks, Wayne! I just typed it in off the top of my head and forget about
that op order glitch.

Cheers,
Graham
 
Back
Top