473,399 Members | 2,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Creating a custom message box when the input mask in a field is not followed.

I am working on a Access data base as a school project. The data base has forms with fields that need to be filled out. The forms currently are set up where certain fields that are required have custom message boxes if they are omitted.
The one problem I am having is to create a custom message box when the input mask that I have specified for phone number is not followed.
'! \ (999")" 000\-0000;;_' I have tried to insert this mask in the validation rule hoping to create a link to the validation text, I am not having any luck.
Thanks,
Lou
Jul 27 '07 #1
18 6101
pbmods
5,821 Expert 4TB
Heya, Lou. Welcome to TSDN!

I'm going to go ahead and move this thread to the Access forum, where our resident Experts will be better able to help you.
Jul 27 '07 #2
ADezii
8,834 Expert 8TB
I am working on a Access data base as a school project. The data base has forms with fields that need to be filled out. The forms currently are set up where certain fields that are required have custom message boxes if they are omitted.
The one problem I am having is to create a custom message box when the input mask that I have specified for phone number is not followed.
'! \ (999")" 000\-0000;;_' I have tried to insert this mask in the validation rule hoping to create a link to the validation text, I am not having any luck.
Thanks,
Lou
Assuming the Phone Number Field is the only Field on your Form for which an Input Mask has been defined, to create a Custom Message Box for an Input Mask Violation on this Field, place the following code in your Form's Error() Event:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  2. If DataErr = 2279 Then      'Input Mask Violation
  3.   MsgBox "You must enter the Area Code + Phone Number as in: (215) 456-9876", vbExclamation, "Invalid Entry"
  4.   Response = acDataErrContinue
  5. Else
  6.   Rersponse = acDataErrDisplay      'let Access handle the Error
  7. End If
  8. End Sub
Jul 28 '07 #3
Assuming the Phone Number Field is the only Field on your Form for which an Input Mask has been defined, to create a Custom Message Box for an Input Mask Violation on this Field, place the following code in your Form's Error() Event:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  2. If DataErr = 2279 Then      'Input Mask Violation
  3.   MsgBox "You must enter the Area Code + Phone Number as in: (215) 456-9876", vbExclamation, "Invalid Entry"
  4.   Response = acDataErrContinue
  5. Else
  6.   Rersponse = acDataErrDisplay      'let Access handle the Error
  7. End If
  8. End Sub
Thank you for your reply. This code works fine if you were closing the form, but there is a SAVE button that updates the table. I can not hit the SAVE button and have my message box show up. A generic Access message box pops up and tells me that the input mask of ……… has been violated. My professor has requested a custom message box if possible. Unfortunately he is not an Access man and I don’t know if that is possible.
Jul 28 '07 #4
ADezii
8,834 Expert 8TB
Thank you for your reply. This code works fine if you were closing the form, but there is a SAVE button that updates the table. I can not hit the SAVE button and have my message box show up. A generic Access message box pops up and tells me that the input mask of ……… has been violated. My professor has requested a custom message box if possible. Unfortunately he is not an Access man and I don’t know if that is possible.
If you are using generic, wizard-generated code to SAVE the Record, it won't make a difference, the Form's Error() Event will still intercept the Input Validation Error and display a Custom Message Box. Are you using custom code to write to a Table? If you are, post the code and I'll see if I can figure a work-a-round.
Jul 28 '07 #5
If you are using generic, wizard-generated code to SAVE the Record, it won't make a difference, the Form's Error() Event will still intercept the Input Validation Error and display a Custom Message Box. Are you using custom code to write to a Table? If you are, post the code and I'll see if I can figure a work-a-round.
I'm working with three other students on this project. I am not the one that wrote the code for the SAVE button, but this is a copy of all the code that I could find that deals with the SAVE button:

Expand|Select|Wrap|Line Numbers
  1. Private Sub SAVE_BUTTON_Click()
  2. On Error GoTo Err_SAVE_BUTTON_Click
  3.  
  4.   DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  5.  
  6. Exit_SAVE_BUTTON_Click:
  7.   RetVal = MsgBox("Invoice Updated", vbOKOnly, "System Alert")
  8.  
  9.   Dim stDocName As String
  10.   Dim stLinkCriteria As String
  11.  
  12.   DoCmd.Close
  13.   stDocName = "Edit Switchboard"
  14.   DoCmd.OpenForm stDocName, , , , acFormAdd
  15. Exit Sub
  16.  
  17. Err_SAVE_BUTTON_Click:
  18.   MsgBox Err.Description
  19.   Resume Exit_SAVE_BUTTON_Click
  20. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub Image17_Click()
  2. On Error GoTo Err_SAVE_BUTTON_Click
  3.  
  4.   DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  5.  
  6. Exit_SAVE_BUTTON_Click:
  7.   RetVal = MsgBox("Employee Updated", vbOKOnly, "System Alert")
  8.  
  9.   Dim stDocName As String
  10.   Dim stLinkCriteria As String
  11.  
  12.   DoCmd.Close
  13.   stDocName = "Edit Switchboard"
  14.   DoCmd.OpenForm stDocName, , , , acFormAdd
  15.     Exit Sub
  16.  
  17. Err_SAVE_BUTTON_Click:
  18.   MsgBox Err.Description
  19.   Resume Exit_SAVE_BUTTON_Click
  20. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub SAVE_BUTTON_Click()
  2. On Error GoTo Err_SAVE_BUTTON_Click
  3.  
  4. Dim stDocName As String
  5. Dim stLinkCriteria As String
  6.  
  7. If Me.Dirty = False Then
  8.   RetVal = MsgBox("Please Input a New Employee!", vbOKOnly, "System Alert")
  9. Else
  10.   DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  11.   DoCmd.Close
  12.   stDocName = "Add Employee"
  13.   DoCmd.OpenForm stDocName, , , , acFormAdd
  14. End If
  15.  
  16. Exit_SAVE_BUTTON_Click:
  17.   Exit Sub
  18.  
  19. Err_SAVE_BUTTON_Click:
  20.   MsgBox Err.Description
  21.   Resume Exit_SAVE_BUTTON_Click
  22. End Sub
Jul 28 '07 #6
ADezii
8,834 Expert 8TB
I'm working with three other students on this project. I am not the one that wrote the code for the SAVE button, but this is a copy of all the code that I could find that deals with the SAVE button:

Expand|Select|Wrap|Line Numbers
  1. Private Sub SAVE_BUTTON_Click()
  2. On Error GoTo Err_SAVE_BUTTON_Click
  3.  
  4.   DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  5.  
  6. Exit_SAVE_BUTTON_Click:
  7.   RetVal = MsgBox("Invoice Updated", vbOKOnly, "System Alert")
  8.  
  9.   Dim stDocName As String
  10.   Dim stLinkCriteria As String
  11.  
  12.   DoCmd.Close
  13.   stDocName = "Edit Switchboard"
  14.   DoCmd.OpenForm stDocName, , , , acFormAdd
  15. Exit Sub
  16.  
  17. Err_SAVE_BUTTON_Click:
  18.   MsgBox Err.Description
  19.   Resume Exit_SAVE_BUTTON_Click
  20. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub Image17_Click()
  2. On Error GoTo Err_SAVE_BUTTON_Click
  3.  
  4.   DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  5.  
  6. Exit_SAVE_BUTTON_Click:
  7.   RetVal = MsgBox("Employee Updated", vbOKOnly, "System Alert")
  8.  
  9.   Dim stDocName As String
  10.   Dim stLinkCriteria As String
  11.  
  12.   DoCmd.Close
  13.   stDocName = "Edit Switchboard"
  14.   DoCmd.OpenForm stDocName, , , , acFormAdd
  15.     Exit Sub
  16.  
  17. Err_SAVE_BUTTON_Click:
  18.   MsgBox Err.Description
  19.   Resume Exit_SAVE_BUTTON_Click
  20. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub SAVE_BUTTON_Click()
  2. On Error GoTo Err_SAVE_BUTTON_Click
  3.  
  4. Dim stDocName As String
  5. Dim stLinkCriteria As String
  6.  
  7. If Me.Dirty = False Then
  8.   RetVal = MsgBox("Please Input a New Employee!", vbOKOnly, "System Alert")
  9. Else
  10.   DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  11.   DoCmd.Close
  12.   stDocName = "Add Employee"
  13.   DoCmd.OpenForm stDocName, , , , acFormAdd
  14. End If
  15.  
  16. Exit_SAVE_BUTTON_Click:
  17.   Exit Sub
  18.  
  19. Err_SAVE_BUTTON_Click:
  20.   MsgBox Err.Description
  21.   Resume Exit_SAVE_BUTTON_Click
  22. End Sub
For which Save Operation can you NOT generate the Custom Message for? (1 or 3).
Jul 28 '07 #7
For which Save Operation can you NOT generate the Custom Message for? (1 or 3).
Is there more to your statement or is the answer that I can not generate the Custom Message?

Thanks,
Lou
Jul 29 '07 #8
Is there more to your statement or is the answer that I can not generate the Custom Message?

Thanks,
Lou
I have just seen your question. (For which Save Operation can you NOT generate the Custom Message for? (1 or 3).) I'm not exactly sure if I know what you are asking me, but I think that you are telling me to try the code you wrote in one of the SAVE button existing codes. What I am looking for is that when the form is filled out and the SAVE button is hit an error message pops up if the phone number has been typed in incorrectly. Reading the code you wrote me I was under thinking that I should be generating the code in the form itself not along with the code for the SAVE button.?? Am I on the right track?

Thanks,
Lou
Jul 29 '07 #9
ADezii
8,834 Expert 8TB
I have just seen your question. (For which Save Operation can you NOT generate the Custom Message for? (1 or 3).) I'm not exactly sure if I know what you are asking me, but I think that you are telling me to try the code you wrote in one of the SAVE button existing codes. What I am looking for is that when the form is filled out and the SAVE button is hit an error message pops up if the phone number has been typed in incorrectly. Reading the code you wrote me I was under thinking that I should be generating the code in the form itself not along with the code for the SAVE button.?? Am I on the right track?

Thanks,
Lou
Sorry for the confusion, Lou. The code I wrote can only go in the Error() Event of the Form on which the Save Button resides. If you have not already done so, post it there. I've posted it again for your reference, good luck.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  2. If DataErr = 2279 Then      'Input Mask Violation
  3.   MsgBox "You must enter the Area Code + Phone Number as in: (215) 456-9876", vbExclamation, "Invalid Entry"
  4.   Response = acDataErrContinue
  5. Else
  6.   Rersponse = acDataErrDisplay      'let Access handle the Error
  7. End If
  8. End Sub
Jul 29 '07 #10
Sorry for the confusion, Lou. The code I wrote can only go in the Error() Event of the Form on which the Save Button resides. If you have not already done so, post it there. I've posted it again for your reference, good luck.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  2. If DataErr = 2279 Then      'Input Mask Violation
  3.   MsgBox "You must enter the Area Code + Phone Number as in: (215) 456-9876", vbExclamation, "Invalid Entry"
  4.   Response = acDataErrContinue
  5. Else
  6.   Rersponse = acDataErrDisplay      'let Access handle the Error
  7. End If
  8. End Sub
I have inspected the event tab in properties for the form, the SAVE button and the home phone field and I do not see anything that is labeled Error so that I can follow your instructions and put the code in the Error() Event of the Form on which the Save Button resides.

I have tried some other stuff and if I can get a message box to pop up for the email field I figured I should get one to pop up for the phone number field. What I have done was:

In the Data tab of the properties section and in the validation rule for my email address I wrote Is Null Or ((Like "*?@?*.?*") And (Not Like "*[ ,;]*")) then in the validation text I wrote Please enter in a valid email address. So when the proper formats as specified in the input mask is not followed the message box pops up.

I tried to write something to go in the validation rule for phone number but I’m not getting it right. I tried Is Null Or ((Like "*!\(000") "000\-0000;1;#*”) And (Not Like “*[ ,, ]*”)) I think if I get this right I might get my message box to pop up. Have you another way to write this code?
Jul 29 '07 #11
ADezii
8,834 Expert 8TB
I have inspected the event tab in properties for the form, the SAVE button and the home phone field and I do not see anything that is labeled Error so that I can follow your instructions and put the code in the Error() Event of the Form on which the Save Button resides.

I have tried some other stuff and if I can get a message box to pop up for the email field I figured I should get one to pop up for the phone number field. What I have done was:

In the Data tab of the properties section and in the validation rule for my email address I wrote Is Null Or ((Like "*?@?*.?*") And (Not Like "*[ ,;]*")) then in the validation text I wrote Please enter in a valid email address. So when the proper formats as specified in the input mask is not followed the message box pops up.

I tried to write something to go in the validation rule for phone number but I’m not getting it right. I tried Is Null Or ((Like "*!\(000") "000\-0000;1;#*”) And (Not Like “*[ ,, ]*”)) I think if I get this right I might get my message box to pop up. Have you another way to write this code?
To Copy and Paste code to the Error() Event of your Form:
  1. Copy the code block that I had Posted
  2. Open the Form in Design View
  3. On the Menu Bar Click View ==> Properties
  4. Click the Event Tab
  5. Select the OnError Event
  6. Click on the ... button
  7. Select Code Builder ==> OK
  8. Your Error() Event should now be visible - Paste or write the code here
Jul 29 '07 #12
To Copy and Paste code to the Error() Event of your Form:
  1. Copy the code block that I had Posted
  2. Open the Form in Design View
  3. On the Menu Bar Click View ==> Properties
  4. Click the Event Tab
  5. Select the OnError Event
  6. Click on the ... button
  7. Select Code Builder ==> OK
  8. Your Error() Event should now be visible - Paste or write the code here
Thank you for your continued help. I did find the Error() Event when I used the View in the menu bar and was able to install your code and saved the code, but the message box does not pop up when the SAVE button is hit. I do get the error message to pop up if I incorrectly input the phone number and try to close the form (X).
Jul 29 '07 #13
ADezii
8,834 Expert 8TB
Thank you for your continued help. I did find the Error() Event when I used the View in the menu bar and was able to install your code and saved the code, but the message box does not pop up when the SAVE button is hit. I do get the error message to pop up if I incorrectly input the phone number and try to close the form (X).
I am sorry, but I cannot make heads or tails of your dilemma. If you have an Input Mask in place on a specific Field and you leave that Field and violate the Input Mask, the Form's Error() Event immediately fires, and in your case the Invalid Input Mask Error is trapped. What this means is that the Click() Event of your Save Button is never executed until you insert the proper Mask or Cancel the entry. I haven't given up yet, but I am running out of options.
Jul 29 '07 #14
I am sorry, but I cannot make heads or tails of your dilemma. If you have an Input Mask in place on a specific Field and you leave that Field and violate the Input Mask, the Form's Error() Event immediately fires, and in your case the Invalid Input Mask Error is trapped. What this means is that the Click() Event of your Save Button is never executed until you insert the proper Mask or Cancel the entry. I haven't given up yet, but I am running out of options.
You are right the SAVE button never executes. When I hit the SAVE button I get an error message generated by Access. Here is a screen shot of the message:



If I hit the (X) I get the custom message. I need to hit the SAVE button and have this message display.


I was hoping that the solution to this problem would be the same as the Email address I talk about before:
In the Data tab of the properties section and in the validation rule for my email address I wrote Is Null Or ((Like "*?@?*.?*") And (Not Like "*[ ,;]*")) then in the validation text I wrote Please enter in a valid email address. So when the proper formats as specified in the input mask is not followed the message box pops up.

I tried to write something to go in the validation rule for phone number but I’m not getting it right. I tried Is Null Or ((Like "*!\(000") "000\-0000;1;#*”) And (Not Like “*[ ,, ]*”)) I think if I get this right I might get my message box to pop up. Have you another way to write this code?

Can I generate any different code that will be accepted because Is Null Or ((Like "*!\(000") "000\-0000;1;#*”) And (Not Like “*[ ,, ]*”)) is giving me an error message when I try to use it.

The screen shots won't copy. Sorry
Jul 30 '07 #15
ADezii
8,834 Expert 8TB
You are right the SAVE button never executes. When I hit the SAVE button I get an error message generated by Access. Here is a screen shot of the message:



If I hit the (X) I get the custom message. I need to hit the SAVE button and have this message display.


I was hoping that the solution to this problem would be the same as the Email address I talk about before:
In the Data tab of the properties section and in the validation rule for my email address I wrote Is Null Or ((Like "*?@?*.?*") And (Not Like "*[ ,;]*")) then in the validation text I wrote Please enter in a valid email address. So when the proper formats as specified in the input mask is not followed the message box pops up.

I tried to write something to go in the validation rule for phone number but I’m not getting it right. I tried Is Null Or ((Like "*!\(000") "000\-0000;1;#*”) And (Not Like “*[ ,, ]*”)) I think if I get this right I might get my message box to pop up. Have you another way to write this code?

Can I generate any different code that will be accepted because Is Null Or ((Like "*!\(000") "000\-0000;1;#*”) And (Not Like “*[ ,, ]*”)) is giving me an error message when I try to use it.

The screen shots won't copy. Sorry
This code, placed in the KeyPress() Event of a Field named Phone, will provide similiar functionality to that of an Input Mask. It captures each Keystroke as they are entered, checks for only valid Keystrokes in specific positions such as: "(" in 1st position, ")" in 5th position, "-" in 10th position, etc., and also allows your custom Error Message. I realize that it is a little extreme, but it is functional, so I'll just through it out there for you to look at:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Phone_KeyPress(KeyAscii As Integer)
  2. Dim intLen As Integer, Msg As String
  3.  
  4. Msg = "You must enter the Phone Number in the following format (XXX) XXX-XXXX"
  5. intLen = Len(Me![Phone].Text)
  6.  
  7. Select Case KeyAscii
  8.   Case 40   '(
  9.     If intLen = 0 Then      '( in the 1st position is OK
  10.     Else
  11.       MsgBox Msg, vbExclamation, "Invalid Entry"       '( in any other position
  12.       KeyAscii = 0
  13.     End If
  14.   Case 41   ')
  15.     If intLen = 4 Then      '( in the 5th position is OK
  16.     Else
  17.       MsgBox Msg, vbExclamation, "Invalid Entry"       '( in any other position
  18.       KeyAscii = 0
  19.     End If
  20.   Case 32      'space
  21.     If intLen = 5 Then      'space in the 6th position is OK
  22.     Else
  23.       MsgBox Msg, vbExclamation, "Invalid Entry"       'space in any other position
  24.       KeyAscii = 0
  25.     End If
  26.   Case 45     '-
  27.     If intLen = 9 Then      '- in the 10th position is OK
  28.     Else
  29.       MsgBox Msg, vbExclamation, "Invalid Entry"       '-  in any other position
  30.       KeyAscii = 0
  31.     End If
  32.   Case 8
  33.     'Backspace is OK anytime
  34.   Case 48 To 57     'the numbers 0 to 9
  35.     Select Case intLen
  36.       Case 1 To 3, 6 To 8, 10 To 13     'numbers in positions 2,3,4,7,8,9,11,12,13,14 are OK
  37.       Case Else
  38.         MsgBox Msg, vbExclamation, "Invalid Entry"       '-  in any other position
  39.         KeyAscii = 0
  40.     End Select
  41.   Case Else
  42.     MsgBox Msg, vbExclamation, "Invalid Entry"
  43.     KeyAscii = 0
  44. End Select
  45. End Sub
Jul 30 '07 #16
This code, placed in the KeyPress() Event of a Field named Phone, will provide similiar functionality to that of an Input Mask. It captures each Keystroke as they are entered, checks for only valid Keystrokes in specific positions such as: "(" in 1st position, ")" in 5th position, "-" in 10th position, etc., and also allows your custom Error Message. I realize that it is a little extreme, but it is functional, so I'll just through it out there for you to look at:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Phone_KeyPress(KeyAscii As Integer)
  2. Dim intLen As Integer, Msg As String
  3.  
  4. Msg = "You must enter the Phone Number in the following format (XXX) XXX-XXXX"
  5. intLen = Len(Me![Phone].Text)
  6.  
  7. Select Case KeyAscii
  8.   Case 40   '(
  9.     If intLen = 0 Then      '( in the 1st position is OK
  10.     Else
  11.       MsgBox Msg, vbExclamation, "Invalid Entry"       '( in any other position
  12.       KeyAscii = 0
  13.     End If
  14.   Case 41   ')
  15.     If intLen = 4 Then      '( in the 5th position is OK
  16.     Else
  17.       MsgBox Msg, vbExclamation, "Invalid Entry"       '( in any other position
  18.       KeyAscii = 0
  19.     End If
  20.   Case 32      'space
  21.     If intLen = 5 Then      'space in the 6th position is OK
  22.     Else
  23.       MsgBox Msg, vbExclamation, "Invalid Entry"       'space in any other position
  24.       KeyAscii = 0
  25.     End If
  26.   Case 45     '-
  27.     If intLen = 9 Then      '- in the 10th position is OK
  28.     Else
  29.       MsgBox Msg, vbExclamation, "Invalid Entry"       '-  in any other position
  30.       KeyAscii = 0
  31.     End If
  32.   Case 8
  33.     'Backspace is OK anytime
  34.   Case 48 To 57     'the numbers 0 to 9
  35.     Select Case intLen
  36.       Case 1 To 3, 6 To 8, 10 To 13     'numbers in positions 2,3,4,7,8,9,11,12,13,14 are OK
  37.       Case Else
  38.         MsgBox Msg, vbExclamation, "Invalid Entry"       '-  in any other position
  39.         KeyAscii = 0
  40.     End Select
  41.   Case Else
  42.     MsgBox Msg, vbExclamation, "Invalid Entry"
  43.     KeyAscii = 0
  44. End Select
  45. End Sub
Again, thank you for the continued help. I entered the code in the KeyPress() Event and found I had to make some minor changes. Phone had to be changed to HomePhone in these two spots:
1) Private Sub Phone_KeyPress(KeyAscii As Integer)
2) intLen = Len(Me![Phone].Text)

When I tried to complete the form and started to enter the home phone number I got the error message:
"You must enter the Phone Number in the following format (XXX) XXX-XXXX"
as soon as I keyed the first number then it stalled right there. I need to turn this in today by 2PM. If you have time to look at it by then that would be great if not thank you for trying and all your time.
Lou
Jul 30 '07 #17
Again, thank you for the continued help. I entered the code in the KeyPress() Event and found I had to make some minor changes. Phone had to be changed to HomePhone in these two spots:
1) Private Sub Phone_KeyPress(KeyAscii As Integer)
2) intLen = Len(Me![Phone].Text)

When I tried to complete the form and started to enter the home phone number I got the error message:
"You must enter the Phone Number in the following format (XXX) XXX-XXXX"
as soon as I keyed the first number then it stalled right there. I need to turn this in today by 2PM. If you have time to look at it by then that would be great if not thank you for trying and all your time.
Lou
I finally came up with an answer for creating a custom message if the input mask is violated. In the properties window for the phone field, open the data tab. In the validation rule I typed in the code Is Null Or (Like "(???) ???-????") which includes making the field not to be required. In the validation text I typed in the custom error message, Please enter a number that is in a (999) 999-9999 format! This is triggered if there are too many or not enough numbers typed into the field.
Jul 31 '07 #18
ADezii
8,834 Expert 8TB
I finally came up with an answer for creating a custom message if the input mask is violated. In the properties window for the phone field, open the data tab. In the validation rule I typed in the code Is Null Or (Like "(???) ???-????") which includes making the field not to be required. In the validation text I typed in the custom error message, Please enter a number that is in a (999) 999-9999 format! This is triggered if there are too many or not enough numbers typed into the field.
I'm glad you arrived at a suitable solution.
Jul 31 '07 #19

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Serious_Practitioner | last post by:
Hello, and thank you in advance for your help. Again. I want to enter the month and day portions only of a date into a table field. The idea is that I'll use the information later to generate a...
2
by: johnp | last post by:
Hi, Our Tech department updated users to Office 2003 this week. Now the input mask in one of the applications is showing up as: (###) ###-### The input mask wizard works correctly when I...
1
by: AA Arens | last post by:
(1) When I want the data in the datafield starts with the first character forcedly uppercased, I use the input mask >L<, followed by ?????. When entering the data, the field is marked with...
3
by: AA Arens | last post by:
When I want the first character of a field to be Uppercased, I need to make an input mask, like >L< followed by ??????? for example. But this mask creates ____ in an unfilled field, which I don't...
6
by: Regnab | last post by:
Morning All, I'm trying to ensure that when the user enters a number on a form, the database automatically leaves a space after the 3rd number. I've tried to do this using input masks, but when...
1
by: namanhvu | last post by:
Hi everyone, I'm trying to create a form where the radio button is automatically selected when the input text field beside it is clicked. I know I need to use "onClick" somewhere but I don't...
1
by: Ntl News Group | last post by:
I have an Access InputBox, when the user enters the text into the strInput I want it to appear as **** like when the Input Mask of Password is selected on a Forms Text Box. Any Ideas? Many...
3
by: louie310 | last post by:
I finally came up with an answer for creating a custom message if the input mask is violated. In the properties window for the phone field, open the data tab. In the validation rule I typed in the...
2
by: ABrown | last post by:
Hi I am having a bit of trouble with something that i am sure is easy, if I wasn't so clueless about VBA, I need to create a Message Box that pops up if a certain value in a field is deleted. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.