View Full Version : Data Masks or validation?


Mark Stones
02-05-2001, 01:45 AM
Hello.


Scenario.
I have a table (tblA) which contain products IDS. This table is linked to another table (tblb)of serial numbers using the product ids. I use a form with tblA with tblb as a subform. All serial numbers are unique for every product. Eg: pcb1 has a serial number AA0001 & pcb2 has a serial number of ZZ0001. The two letters prefixed in the serial number are used to determine which product it is for.

Problem.
I would like to know if it is possible to 'validate' or set masks for these serial number prefixes depending on which product is selected so that the correct prefix is entered in new records.

Thankyou

Mark

Chris RR
02-05-2001, 08:52 AM
OK, what I think you are asking is this: Can I customize the serial number field based on what the user entered into the product field?

Sure, in code. In the after update property for the product code (here called cboProduct), put something like this:

Me.CD_Serial = Null

Select Case Me.cboPRODUCT

Case "WIDGET"
Me.CD_Serial.InputMask = 'whatever
Case "THINGIE"
Me.CD_Serial.InputMask = 'something else
Case Else
Me.CD_Serial.InputMask = "" 'or your default mask
End Select
'then if you want to put the user right into the serial number field
Me.CD_Serial.SetFocus