date default issue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that has 2 fields on it; one for begin date and the other for
end date. The users want both of these fields to default to the first day
and last day of the previous month. (ex: we are in June so the defaults
would be 5/1/2007 and 5/31/2007). I am at a lost on doing this and ask for
help from the news group.
Thanks for any help given.
.... John
 
You can write it either in the form text box or in the table fields, in the
default value

In the Start Date
DateSerial(Year(DateSerial(Year(Date()), Month(Date()),
0)),Month(DateSerial(Year(Date()), Month(Date()), 0)),1)

In the End Date
DateSerial(Year(Date()),Month(Date()),0)
 
JohnE said:
I have a form that has 2 fields on it; one for begin date and the
other for end date. The users want both of these fields to default
to the first day and last day of the previous month. (ex: we are in
June so the defaults would be 5/1/2007 and 5/31/2007). I am at a
lost on doing this and ask for help from the news group.
Thanks for any help given.
... John


Default Values of...

=DateSerial(Year(Date()), Month(Date())-1, 1)
=DateSerial(Year(Date()), Month(Date()), 0)
 
Perfect!
Thanks.


Ofer Cohen said:
You can write it either in the form text box or in the table fields, in the
default value

In the Start Date
DateSerial(Year(DateSerial(Year(Date()), Month(Date()),
0)),Month(DateSerial(Year(Date()), Month(Date()), 0)),1)

In the End Date
DateSerial(Year(Date()),Month(Date()),0)
 
Ofer said:
You can write it either in the form text box or in the table fields,
in the default value

In the Start Date
DateSerial(Year(DateSerial(Year(Date()), Month(Date()),
0)),Month(DateSerial(Year(Date()), Month(Date()), 0)),1)

Why all of that when...

DateSerial(Year(Date()), Month(Date())-1,1)

....gives the same result?
 
You right Rick

For some reasone I thought that I'll have a problem with January, you method
is correct

Thank you
 
Back
Top