Consulting

Results 1 to 3 of 3

Thread: Solved: logic help

  1. #1

    Solved: logic help

    hi,
    i want to validate the date in correct format:
    - the date is numeric
    - the date is 8 digits in length
    - the date is not empty.
    But i have problems with the logic below:
        Do
            rDate = InputBox("Input date (yyyymmdd)")
        Loop While rDate <> "" And Len(rDate) <> 8 And IsNumeric(rDate)
    Pls advise, thanks.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Do
    rDate = InputBox("Input date (yyyymmdd)")
    Loop While rDate = "" Or Len(rDate) <> 8 Or Not IsNumeric(rDate)
    [/vba]
    ____________________________________________
    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

  3. #3
    Dear xld,
    many thanks, it works perfectly

Posting Permissions

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