Jump to content

Ranges


Recommended Posts

I want a program to verify the date that the user entered into the program to be valid (to a degree). The format for the user is "062905".

If StringMid($Date,3,2) <> 01 To 31 Then
   MsgBox(0,"Notice 23","Bad")
   Exit
EndIf
I want something like that (above) to check the day, but that clearly will not work. Is there another method to go about this?

Another issue is

If StringTrimLeft($Date,4) <> StringTrimLeft(@year,2) Or StringTrimLeft($Date,4) <> StringTrimLeft(@year,2)+1 Then
   MsgBox(0,"Notice 19","Bad")
   Exit
EndIf

This doesn't work also. At the end of the year we will start packing stuff for the next year so it needs to allow the next year to be accepted (this is the same for the month).

Here is what I have so far all together:

$Date = InputBox("Trial","Date:","040506")
If StringLen($Date) <> 6 Then
   MsgBox(0,"Notice 3","Bad")
   Exit
EndIf
If StringIsDigit($Date) = 0 Then
   MsgBox(0,"Notice 7","Bad")
   Exit
EndIf
If $Date = "" Then
   MsgBox(0,"Notice 11","Bad")
   Exit
EndIf
If StringTrimRight($Date,4) <> @MON Then
;~  Or StringTrimRight($Date,4) <> @MON +1 Then
   MsgBox(0,"Notice 15","Bad")
   Exit
EndIf
If StringTrimLeft($Date,4) <> StringTrimLeft(@year,2) Then
;~  Or StringTrimLeft($Date,4) <> StringTrimLeft(@year,2)+1
   MsgBox(0,"Notice 19","Bad")
   Exit
EndIf
If StringMid($Date,3,2) <> 01 To 31 Then
   MsgBox(0,"Notice 23","Bad")
   Exit
EndIf

Any ideas would be great I'm sure I'm just missing something.

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...