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

Date value

Status
Not open for further replies.

mflower

MIS
May 6, 2001
52
0
0
NZ
Hi! Anyone knows how to code this if statement:

If date.Value >= "#01/01/00#" Then
label1.Visible = True
Else
label1.Visible = False
End If

Somehow the label1.Visible is always true, so I suspect that if I want to find a date greater than 01/01/00, for example if the date is 01/01/99, then the label1.Visible is false, but it's still visible.

Thanks.

 
You could try losing the quotes around the date you are comparing to.


If date.Value >= #01/01/00# Then


that seemed to make the difference when I was testing it.

I might actually go about it a differenty way though but I am not quite sure exactly what you are doing.


Dim dtTempDate as Date

If IsDate(txtDate.value) Then
dtTempDate = txtDate.value
If dtTempDate >= #01/01/00# Then
Label1.Visible = True
Esle
Label1.Visible = False
End If
End If


You probably already have a date mask on the field but I generaly code with the possibility that the correct value will not be passed. Such as an imcomplete date or such.

Anyway, hope this helps....
 
Hi mflower!
are you sure that you are putting the code in the right event? you have to put that piece of code in the form event "On Current"! xcept for the quotes i can't see nothing unusual in the code so, it should be that!

Good luck!

Skep :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top