rohksie Posted March 24, 2008 Share Posted March 24, 2008 Hello again another easy question for those more experienced...whereas I am an idiot smiley-cry ...Anyway I would like to know if there is a way to validate custom text...for example I have a job number with two formats....##-##### and ##-####...in browse (data entry) and search, when a user enters that field I want it to be able to validate if is the right format or if there are enough numbers/characters blah blah. I've seen the social security version but even that was formatted to auto enter it for you, my problem is though that I have two formats for the same field? Is there someway to do a calculation validation for this? Help smiley-cry smiley-cry smiley-cry TIA!! Link to comment Share on other sites More sharing options...
Weetbicks Posted March 24, 2008 Share Posted March 24, 2008 Under the field validation, use "Validate by calculation", you can specify a calculation to use as validation. Your calc would probably use an if or case statement to check the phone # is one of the two formats. Link to comment Share on other sites More sharing options...
rohksie Posted March 25, 2008 Author Share Posted March 25, 2008 Thanks Weetbix... I found this earlier and fixed it to follow my job order format from a ssn code Let ( [rawNumber = Filter (WO#; "0123456789"); length = Length (rawNumber); red = RGB (160;0;0); error = "Invalid Work Order #" ; validNum = Left (rawNumber; 2) & "-" & Middle (rawNumber; 3; 4) ]; Original Validation part of the code If ( length 9; TextColor( error; red ); TextColorRemove( validNum ) ) ) I need to fix the validation so that 7 would make it inivalid...any clues? Link to comment Share on other sites More sharing options...
David Head Posted March 25, 2008 Share Posted March 25, 2008 How about this: Let ([ rawNumber = Filter (WO#; "0123456789"); len = Length (rawNumber); red = RGB (160;0;0); error = "Invalid Work Order #" ; validNum = Left (rawNumber; 2) & "-" & Middle (rawNumber; 3; [b]5[/b]) ]; If ([b]len = 6 or len = 7[/b]; TextColorRemove( validNum ); WO# & " " & TextColor( error; red ) ) ) Link to comment Share on other sites More sharing options...
rohksie Posted March 25, 2008 Author Share Posted March 25, 2008 thanks david that works pefect BUT...I stumbled on to another problem....there's also ANOTHER format for the work order which renders it useless...besides the (##-#####) and (##-####) it seems theres also this "##-##/##ABC" I'm thinking its almost hopeless to even bother putting it in the same field as WO# the problem though is IT IS a WO#...although this WO# is only if another field "Job Type"="Material Sale" so I think my new overall question is...can I enter it as some kind of case/if that if field Job Type=Material Sale then WO# is formatted to "##-##/ABC" instead of the other two? I really appreciate all the help...REALLY!! Link to comment Share on other sites More sharing options...
rohksie Posted March 25, 2008 Author Share Posted March 25, 2008 let me edit my previous post I meant to say "##-##/##ABC" Link to comment Share on other sites More sharing options...
Recommended Posts