gnarpeggio
Registered User.
- Local time
- Today, 10:27
- Joined
- Jun 22, 2010
- Messages
- 74
Hello,
I'm starting out on a new database for my staff to create labels for correspondence folders, and I'm in need of some help.
I have an unbound field that I want a command button to evaluate to check the field before moving onto the report. My first idea was to use a validation rule, but this would be for multiple rules in the same field, which I wasn't sure I could do. I'm trying to get the DB to only accept the following types:
A###### - The letter "A" followed by six digits
D######R - The letter "D" followed by six digits, then the letter "R"
L###### - The letter "L" followed by six digits
WW#### - Two "W" letters followed by 4 digits
I figured using the ElseIf method would work as well, but I'm having difficulty preparing the code:
Sub cmdCreateLabel_Click()
Dim strIncorrect As String
strIncorrect = MsgBox "Please enter only the following: [format examples]" vbOkOnly
If txtAppID (Does Not Equal A######) Then
Msgbox strIncorrect
txtAppID.SetFocus
ElseIf
... Repeat for other types ...
End If
End Sub
My last idea was using the Format property in VBA, but the DB recognized "A" as a literal character.
Any ideas?
Thanks!
I'm starting out on a new database for my staff to create labels for correspondence folders, and I'm in need of some help.
I have an unbound field that I want a command button to evaluate to check the field before moving onto the report. My first idea was to use a validation rule, but this would be for multiple rules in the same field, which I wasn't sure I could do. I'm trying to get the DB to only accept the following types:
A###### - The letter "A" followed by six digits
D######R - The letter "D" followed by six digits, then the letter "R"
L###### - The letter "L" followed by six digits
WW#### - Two "W" letters followed by 4 digits
I figured using the ElseIf method would work as well, but I'm having difficulty preparing the code:
Sub cmdCreateLabel_Click()
Dim strIncorrect As String
strIncorrect = MsgBox "Please enter only the following: [format examples]" vbOkOnly
If txtAppID (Does Not Equal A######) Then
Msgbox strIncorrect
txtAppID.SetFocus
ElseIf
... Repeat for other types ...
End If
End Sub
My last idea was using the Format property in VBA, but the DB recognized "A" as a literal character.
Any ideas?
Thanks!