Results 1 to 3 of 3

Thread: I guess I've finally gone off the deep end...

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2001
    Posts
    27

    Angry 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

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Try:
    VB Code:
    1. 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.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2001
    Posts
    27
    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
  •  



Click Here to Expand Forum to Full Width