G
Grigby
Hi,
I have a form, with a serial number field with the
following code:
Private Sub SN_BeforeUpdate(Cancel As Integer)
Dim lngLen As Long
Dim strMsg As String
lngLen = Len(Nz(Me.SN, ""))
If lngLen < 6 Or lngLen > 25 Then
Cancel = True
strMsg = "SN must be 6 to 25 characters." &
vbCrLf & _
"Correct the entry, or press <Esc> to undo."
MsgBox strMsg, vbExclamation, "Invalid entry"
End If
End Sub
As part of this I also need to include a restriction on
the use of "-, /, \, +, * etc... In short the field can
only contain numbers and letters. I reviewed some
material similar to... If Not me!{SN} Like, but then
noted the number of potential variables. Can the code
above be modified to meet the restriction on the dash,
plus, slash, etc... Any guidance, code change, reading
material etc... would be appreciated ...
Thanks,
Greg
I have a form, with a serial number field with the
following code:
Private Sub SN_BeforeUpdate(Cancel As Integer)
Dim lngLen As Long
Dim strMsg As String
lngLen = Len(Nz(Me.SN, ""))
If lngLen < 6 Or lngLen > 25 Then
Cancel = True
strMsg = "SN must be 6 to 25 characters." &
vbCrLf & _
"Correct the entry, or press <Esc> to undo."
MsgBox strMsg, vbExclamation, "Invalid entry"
End If
End Sub
As part of this I also need to include a restriction on
the use of "-, /, \, +, * etc... In short the field can
only contain numbers and letters. I reviewed some
material similar to... If Not me!{SN} Like, but then
noted the number of potential variables. Can the code
above be modified to meet the restriction on the dash,
plus, slash, etc... Any guidance, code change, reading
material etc... would be appreciated ...
Thanks,
Greg