|
-
Jul 17th, 2001, 01:34 PM
#1
Thread Starter
Junior Member
I guess I've finally gone off the deep end...
What's wrong with this VBScript code??? I've been looking at it for the last hour and can't find what's wrong with it. I've triple-checked all my calls and variables, etc. but everytime a date which is less than NOW is entered into the date field (txtAppDateMoved) it thinks that the date is higher and triggers the second message box.
I'm going CRAZY!!!
code:
Sub txtAppDateMoved_onchange
Dim bDateGood
Dim Mydate
Mydate = Now
bDateGood = IsDate(txtAppDateMoved.Value)
If bDateGood = False Then
MsgBox "Please enter a valid date as 'mm/dd/yyyy' in the Date Moved field.", vbOKOnly, "Error"
txtAppDateMoved.focus
ElseIf txtAppDateMoved.Value > Mydate Then
MsgBox "The date entered is past today's date. Please correct.", vbOKOnly, "Error"
txtAppDateMoved.focus
Else
txtAppDateMoved.Value = FormatDateTime(txtAppDateMoved.Value)
End If
End Sub
-
Jul 17th, 2001, 01:47 PM
#2
Black Cat
Try:
VB Code:
ElseIf CDate(txtAppDateMoved.Value) > Mydate Then
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Jul 17th, 2001, 01:54 PM
#3
Thread Starter
Junior Member
In the words of "Doc" Brown:
"IT WOOORRKS!!!!!!!!!!!!!!!!!!"
Thank you, Thank you, Thank you, Thank you, Thank you!!!!
I'm not insane!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|