stevenyoo321
New member
- Local time
- Today, 06:39
- Joined
- Feb 2, 2007
- Messages
- 6
Question:
You need to create an event procedure to verify the value entered for Postal Code textbox. If a user does not enter any value for postal code, a message box will open to alert the user that the field is required. If the state for the customer is TX, verify that the first two digits of the zip code (for Texas) start from 73 to 79. An error message box will open if the zip code is not in that range.
Currently I'm not sure how to verify the first 2 digits of the zip code for TX. This is what I have so far:
Private Sub Postal_Code_BeforeUpdate(Cancel As Integer)
If IsNull([Postal Code]) Then
strMsg = "You must enter a Zip Code"
strTitle = "Zip Code Required"
MsgBox strMsg, vbOKOnly, strTitle
Cancel = True
End If
End Sub
Private Sub State_BeforeUpdate(Cancel As Integer)
End Sub
Thank you for your time and effort I hope someone wil be able to answer my question. I'm very new to VBA and is just trying to learn and work out this problem. Thank you again.
You need to create an event procedure to verify the value entered for Postal Code textbox. If a user does not enter any value for postal code, a message box will open to alert the user that the field is required. If the state for the customer is TX, verify that the first two digits of the zip code (for Texas) start from 73 to 79. An error message box will open if the zip code is not in that range.
Currently I'm not sure how to verify the first 2 digits of the zip code for TX. This is what I have so far:
Private Sub Postal_Code_BeforeUpdate(Cancel As Integer)
If IsNull([Postal Code]) Then
strMsg = "You must enter a Zip Code"
strTitle = "Zip Code Required"
MsgBox strMsg, vbOKOnly, strTitle
Cancel = True
End If
End Sub
Private Sub State_BeforeUpdate(Cancel As Integer)
End Sub
Thank you for your time and effort I hope someone wil be able to answer my question. I'm very new to VBA and is just trying to learn and work out this problem. Thank you again.