RegEx on TextField?

A|ex

Registered User.
Local time
Today, 21:50
Joined
Jul 11, 2004
Messages
90
Is it possible to use a regex in Access on a text field? i want to allow...

L000000

A letter and 6 numbers the letter can ONLY be W or C then any numbers after?

How would i do that in access? would i need to use substring? even so regex in access would be fine ;)
 
regular expression they are ideal for checking strings/text
 
Hum... Seems I read where vba does support regular expressions, but I never have used them. Guess you try and see? Please post your how you used it in your example and if it did or didn't work...

???
ken
 
Type L00000 expression in input mask property in textbox control.
Also you can validate 1 letter for "W" or "C" value like

Private Sub YourTextBoxName_BeforeUpdate(Cancel As Integer)

If Left(YourTextBoxName,1)="W" Or Left(YourTextBoxName,1)="C" Then
Else
MsgBox "Invalid 1st character!"
Cancel=True
End If

End Sub
 
Ah you are checking the first character to see if its W or C.

Thanks i will test it when i get back home!
 

Users who are viewing this thread

Back
Top Bottom