Results 1 to 13 of 13

Thread: Texbox - Numbers ONLY - Date

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    This is overkill as the IsDate function will not allow an invalid number of days or months, so all you need is

    Private Sub CommandButton1_Click()
        If Not IsDate(TextBox1.Value) Then
            MsgBox ("This is not a date, Please try again")
        Else
            MsgBox ("This is a date, Good for you")
        End If
    End Sub
    In addition, your way only works for US dates, as we continentals use a dd/mm/yy format, where the first two digits can be greater than 12. Mine works for any.

    .
    Last edited by Aussiebear; 03-23-2025 at 08:59 AM.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •