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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing Months

Status
Not open for further replies.

MrsNic

Instructor
Feb 6, 2005
44
GB
I want to compare a date with today's date and if the month is greater to put a Yes in a text box, if not no.

I have tried the Iff function and DateDiff but I don't seem to be getting the syntax correct.

Any help gratefully received.

Cath
 
Where are you doing the comparing? In a query? In event code in a form? Does the year make any difference?

HTH RuralGuy (RG for short) acXP winXP Pro
Please respond to this forum so all may benefit
 
try this:

Code:
IIf(CDate(Me.Text1.Value) = Date, "True", "False")

Cheers

Nick
 
I should maybe expand slightly on my example!!:

Code:
Dim CheckIt

CheckIt = IIf(CDate(Me.Text1.Value) = Date, "True", "False")

Me.Text2.Value = CheckIt

Cheers

Nick
 
How are ya MrsNic . . .

Perhaps this:
Code:
[blue]= IIf(Month(CDate(Me.Text1.Value)) > Month(Date), "True", "False")[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top