First of Month, Last of Month

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

Guest

I want to create an IF statement to discover whether an entered date in a
table is the first or the last of a month, irrespective of the year. I need
the identification so that I can calculate from the entered date.

Is there someone who can help. I'd really appreciate it. Thanks.
 
Assuming name of field is [MyDate],

=IIf([MyDate]=DateSerial(Year([MyDate], Month([MyDate] + 1, 0), "The date is
last day of month", IIf([MyDate]=DateSerial(Year([MyDate], Month([MyDate],
1, "The date is first day of month", "The date is neither first nor last day
of month"))
 
Just to add to Ken's note: There is a great article on the Microsoft website
"Functions for Calculating and Displaying Date/Time Values" which addresses a
lot of these formulas.


Ken Snell said:
Assuming name of field is [MyDate],

=IIf([MyDate]=DateSerial(Year([MyDate], Month([MyDate] + 1, 0), "The date is
last day of month", IIf([MyDate]=DateSerial(Year([MyDate], Month([MyDate],
1, "The date is first day of month", "The date is neither first nor last day
of month"))

--

Ken Snell
<MS ACCESS MVP>


BurtArkin said:
I want to create an IF statement to discover whether an entered date in a
table is the first or the last of a month, irrespective of the year. I need
the identification so that I can calculate from the entered date.

Is there someone who can help. I'd really appreciate it. Thanks.
 
Thank you. Your answer was right on the money!

Ken Snell said:
Assuming name of field is [MyDate],

=IIf([MyDate]=DateSerial(Year([MyDate], Month([MyDate] + 1, 0), "The date is
last day of month", IIf([MyDate]=DateSerial(Year([MyDate], Month([MyDate],
1, "The date is first day of month", "The date is neither first nor last day
of month"))

--

Ken Snell
<MS ACCESS MVP>


BurtArkin said:
I want to create an IF statement to discover whether an entered date in a
table is the first or the last of a month, irrespective of the year. I need
the identification so that I can calculate from the entered date.

Is there someone who can help. I'd really appreciate it. Thanks.
 
You're welcome.

--

Ken Snell
<MS ACCESS MVP>

BurtArkin said:
Thank you. Your answer was right on the money!

Ken Snell said:
Assuming name of field is [MyDate],

=IIf([MyDate]=DateSerial(Year([MyDate], Month([MyDate] + 1, 0), "The date is
last day of month", IIf([MyDate]=DateSerial(Year([MyDate], Month([MyDate],
1, "The date is first day of month", "The date is neither first nor last day
of month"))

--

Ken Snell
<MS ACCESS MVP>


BurtArkin said:
I want to create an IF statement to discover whether an entered date in a
table is the first or the last of a month, irrespective of the year.
I
need
the identification so that I can calculate from the entered date.

Is there someone who can help. I'd really appreciate it. Thanks.
 

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

Back
Top