Re: formatting input boxes



Split the checking into 4 section to be certain...

'Check the number of characters....
if len(sYear) <> 6 then
'Error Message
end if

you also need to validate each section (ie the year and the quarter),
to do this is also simple...

'Check that the first 4 characters are numbers which will represent the
year.
if isnumeric(left(sYear,4)) = false then
'Error Message
end if

'Check that the 5th character is the letter "Q".
if mid(sYear,5,1)) <> "Q" then
'Error Message
end if

'Check that the final character is a number which represents the
quarter.
if isnumeric(right(sYear,1)) = false then
'Error Message
end if

Obviously you can just put them all into one if statement using the OR
command, but thought it would be easier to explain that way.

.



Relevant Pages

  • Re: Reading a file from a specified range
    ... The command that produces the error may be, ... | more than three rows above the error message. ... | character instead of going backwards some defined number of rows. ...
    (comp.lang.cpp)
  • Re: strong passwords
    ... I have seen a user forget a 6 character password in 10-20 seconds though. ... "Herb Martin" wrote in message ... Workstations) as your users will most likely NOT come up with ... >> in an error message that is quite generic and not very informative. ...
    (microsoft.public.win2000.active_directory)
  • Re: Zeos Acces + Firebird
    ... arithmetic exception, numeric overflow, or string truncation ... > Cannot transliterate character between caracter sets. ... So your error message is right on the money. ... is being asked to, and cannot, transliterate that character. ...
    (alt.comp.lang.borland-delphi)
  • Strange display when crashing
    ... This means that the error message can't be read ... character effect is the only reason we've been able to read ... OEM version of Windows 2000 Pro ... Windows is reporting RAM as 228MB, ...
    (microsoft.public.win2000.general)
  • Re: Reading a file from a specified range
    ... The command that produces the error may be, ... more than three rows above the error message. ... character instead of going backwards some defined number of rows. ...
    (comp.lang.cpp)