Subform - Input Validation / text field

Hello,

I have a form that consists of 5 subforms that the user picks from a prompt (to bring up the subform). In one of the subforms, I have a text field that verifies if the input has a combination of letters and numbers. The code is placed in the input validation. The problem i receive is that when I select from the prompt to bring up the subform, My error message comes up automatically. The form does not automatically refresh. I dont know what im doing wrong. Here’s my code.

This code works if the text field is used in a basic form.

letters := “A”:“B”:“C”:“D”:“E”:“F”:“G”:“H”:“I”:“J”:“K”:“L”:“M”:“N”:“O”:“P”:“Q”:“R”:“S”:“T”:“U”:“V”:“W”:“X”:“Y”:“Z”;

numbers := “0”:“1”:“2”:“3”:“4”:“5”:“6”:“7”:“8”:“9”;

msg := “Field must contain 2 letters and 5 numbers; total of 7 characters.”;

@If(@IsDocBeingSaved & @Contains(@UpperCase(@Text(InputNum));letters) & @Contains(InputNum;numbers) + @Length(InputNum) = 7; “(” + @Left(InputNum; 2);letters + ") " + @Right(InputNum; 5);numbers; InputNum);

@If(@Length(InputNum) = 7 | @Length(InputNum) = 7 & InputNum != “”;@Success;@Failure(msg))

Subject: Subform - Input Validation / text field

Here are some validation formulas which might help:

REM “Numbers Only:”;

@If(

PhoneNumber=“”;@Success;

@Matches(PhoneNumber; “+{0-9}”);@Success;

@Failure(“Invalid Character in PhoneNumber. Numbers Only”))

REM “Text Only:”;

@If(

FirstName=“”;@Success;

@Matches(FirstName; “+{a-zA-Z}”);@Success;

@Failure(“Invalid Character in First Name. Text Only”))

REM “Numbers & Text Only w/Prompt Box:”;

@If(

Serial_Num=“”;@Success;

@Matches(Serial_Num; “+{0-9}”); @Success;

@Matches(Serial_Num; “+{a-zA-Z}”); @Success;

@Do(@Prompt([OK]; “Invalid Serial Number”; “The Unit Serial Number contains an illegal character, probably a carriage return. Please remove the illegal character and save again.”); @Return(“”))

)

Subject: RE: Subform - Input Validation / text field

Thanks Stan!