Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to check if today is the 1st of the month

Status
Not open for further replies.

pauljkeenan

Programmer
Jun 19, 2006
41
0
0
TR
Hi people

I have an add record form where the user adds the date that an application was filled out. I need to know how I can check on start up whether the date entered is the 1st of the month. I know there is a month function but how do I check if its the 1st?

thanks for any help

I love you
 
if day(date) = 1 then
do something
end if

The "day" function returns an integer representing the number of the day
 
its wonderfully easy, thanks for the help Majp.

I assume 'date' represents the textbox containing the date?

 
no do not name any object "date". Date is another function that returns todays date.
Look up
date()
now()
day()
year()
month()
weekday()
dateserial()
 
thanks a million lads, you've been great out there. sorry about the remedial questions, im learning by making mistakes

 
that should work fine but Im getting weird results for the month function in certain forms.
I get a type mismatch for the following code

Private Sub Form_Open(Cancel As Integer)
If Month(date) = 8 Then
MsgBox "indeed"
End If
End Sub

But if I use it in a different form it works, or if I use day function it works. how can this happen? it really cannot, or can it?
 
You don't have any object named Month or date in the form exhibiting this behaviour ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Yes, the problem was the field name was month, stupid mistake I keep on making.

thanks phv
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top