Incoming string follows specific character format

chris-uk-lad

Registered User.
Local time
Today, 02:29
Joined
Jul 8, 2008
Messages
271
Im trying to make sure an incoming string follows the format ***-****** but the below line doesnt awknowledge values that do follow the format

Code:
If val1 = "***-******" Then

Where each * is a number or character. What am i doing wrong with this :s

Many Thanks
 
Suggestion

Code:
If IsNumeric(Left(String,3) And IsNumeric(Right(string,6) Then
   True
Else
   False
End If
 
i appreciate the effort but its not about making sure the 3 and 6 are numerics, i actually need the string to 'look like' ***-******

e.g.

100-102010

its a validation to make sure no values come in that may resemble 100102

Suggestion

Code:
If IsNumeric(Left(String,3) And IsNumeric(Right(string,6) Then
   True
Else
   False
End If
 
Ok then just extend the check to include the hyphen check.

IsNumeric(Left(String,3) And IsNumeric(Right(string,6) And Mid(string,4,1) = "-"
 
Just a thought... You could seperate it into two fields [do your validations on each field for more control] then merge the two fields into a hidden field that is bound to your table.
 

Users who are viewing this thread

Back
Top Bottom