By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,778 Members | 1,318 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,778 IT Pros & Developers. It's quick & easy.

Editing lablels for input masks

P: 53
a few days a go i was kindly helped with the trouble i was having on editing lables wjhere i wanted to change access' messages to my own.
Below si the qeustion i set a few days agoa , which worked brillintantly with the answer posted below


how do you enable when making a order in the sub form called “all customer order details sub form” alter the error message when you put the same product in the same order.

currently in the all customer order details sub form”, i am mot allowed to enter products in twice for one order which is great. however the error message is automatic, and i want to edit this.
Have you got any tips, it will be much apreciated
thank you
If I follow your logic correctly, you wish to replace the Standard Acces Error message with a custom one of you choice and not display the generic one from Access. To accomplish this, you must place code in the Form's Error() Event and place the proper value in the Response parameter.


Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  2. Const conDuplicateKey = 3022
  3. Dim strMsg As String
  4.  
  5. If DataErr = conDuplicateKey Then
  6. Response = acDataErrContinue
  7. strMsg = "Each employee record must have a unique " _
  8. & "employee ID number. Please recheck your data."
  9. MsgBox strMsg
  10. End If
  11. End Sub 
  12.  
i now want to know how do you do alter the message, if i have placed an input mask e.g L?09\ 0LL for a post code in the main table design Customer. i would like to edit this, as the message is not userfreinfly and shopws the input maks.i would like to know how and where i place the new user freindly message. is it in the form?
is it always the same template for all input masks, as i have quite a few.
thankyou so much, you were great help last time!
THANK YOU!
Panjap
Feb 14 '07 #1
Share this Question
Share on Google+
12 Replies


NeoPa
Expert Mod 15k+
P: 31,489
Are you talking about an error message associated with the Input Mask or with field validation?
If the latter, then you need to put it in the Validation Text property.
Feb 15 '07 #2

P: 53
Are you talking about an error message associated with the Input Mask or with field validation?
If the latter, then you need to put it in the Validation Text property.
hello, thank you for your reply,
i am taliking about the error message associates with the input mask.
e.g. for the field Poscode, i have inserted an input mask - L?09\ 0LL
If i do not follow this out correctly, and place in a worng postcode, i get, an error message saying, 'The value you have entered isn't appropiate for the input mask 'L?09\ 0LL' ,specified for this field.
How do i alter this to make is more user freindly for my forms, i have tried validation text and this does not work.
Thank you once again!
Feb 16 '07 #3

NeoPa
Expert Mod 15k+
P: 31,489
Sorry Panjap - I just don't know I'm afraid.
I'll see if I can get someone else to look at this for you.
Feb 16 '07 #4

P: 53
Sorry Panjap - I just don't know I'm afraid.
I'll see if I can get someone else to look at this for you.
thankyou NeoPa, thanks for trying.
cheers
Feb 16 '07 #5

NeoPa
Expert Mod 15k+
P: 31,489
Don't give up just yet.
I've invoked a 'Swarm' of Access Experts - let's see if someone can come up with something.
Feb 16 '07 #6

ADezii
Expert 5K+
P: 8,636
a few days a go i was kindly helped with the trouble i was having on editing lables wjhere i wanted to change access' messages to my own.
Below si the qeustion i set a few days agoa , which worked brillintantly with the answer posted below



If I follow your logic correctly, you wish to replace the Standard Acces Error message with a custom one of you choice and not display the generic one from Access. To accomplish this, you must place code in the Form's Error() Event and place the proper value in the Response parameter.


Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  2. Const conDuplicateKey = 3022
  3. Dim strMsg As String
  4.  
  5. If DataErr = conDuplicateKey Then
  6. Response = acDataErrContinue
  7. strMsg = "Each employee record must have a unique " _
  8. & "employee ID number. Please recheck your data."
  9. MsgBox strMsg
  10. End If
  11. End Sub 
  12.  
i now want to know how do you do alter the message, if i have placed an input mask e.g L?09\ 0LL for a post code in the main table design Customer. i would like to edit this, as the message is not userfreinfly and shopws the input maks.i would like to know how and where i place the new user freindly message. is it in the form?
is it always the same template for all input masks, as i have quite a few.
thankyou so much, you were great help last time!
THANK YOU!
Panjap
Sorry Panjap:
To the best of my knowledge, there is no way to modify the Default Access Error Message for invalid Input Masks. I'm afraid this is controlled internally by Access. Don't give up hope - I could be wrong. I did, however, post this Pseudo Input Mask Validation Code just in case you are interested. It's just a guideline and I'm sure it can be imroved and/or streamlined. It checks for an Input Mask of L0\0:
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtTest_BeforeUpdate(Cancel As Integer)
  2. If Len(Me![txtTest]) <> 3 Then  'must be 3 Characters
  3.   MsgBox "Entry must be exactly 3 Characters long", vbExclamation, "Invalid Entry"
  4.     Cancel = True
  5. 'Check for A - Z in the 1st character
  6. ElseIf Asc(Left(Me![txtTest], 1)) < 65 Or Asc(Left(Me![txtTest], 1)) > 90 Then
  7.   MsgBox "Only letters A thru Z required in the 1st Character", vbExclamation, "Invalid Entry"
  8.     Cancel = True
  9. 'Check for any digit 0 - 9 in the 2nd position
  10. ElseIf Asc(Mid(Me![txtTest], 2, 1)) < 48 Or Asc(Mid(Me![txtTest], 2, 1)) > 57 Then
  11.   MsgBox "Any Digit 0 -9 is required in the 2nd Character", vbExclamation, "Invalid Entry"
  12.     Cancel = True
  13. 'Check for the Literal "(" in position 3
  14. ElseIf Mid(Me![txtTest], 3, 1) <> "(" Then
  15.   MsgBox "( must appear in the 3rd Character", vbExclamation, "Invalid Entry"
  16.     Cancel = True
  17. End If
  18. End Sub
Feb 16 '07 #7

100+
P: 1,646
Here is the answer for access 2000. You can check it for us and let us know if it still works.
Feb 16 '07 #8

NeoPa
Expert Mod 15k+
P: 31,489
Nice one Will.
Panjap, can you do the business and let us know how you get on. We're all interested in this one now :)
Feb 16 '07 #9

ADezii
Expert 5K+
P: 8,636
Here is the answer for access 2000. You can check it for us and let us know if it still works.
Nice job willy!
Feb 16 '07 #10

P: 53
THAT WAS BRILLIANT!!!!!!!!!!!!!!!!!!
Thankyou so much, you made my day, i really appreciate the time you all spent finding this, i know how hard it was to do. Cheers you all for all the help
i really appreciate all that you all did!
Panjap
Feb 16 '07 #11

P: 53
Thankyou for all your help. i just have one last question

how do you when making a order in the form called “all customer order details sub form” insert an error message into sub form called
"amount owed customer 3", where i have calculated the balance left on a credit limit. How do i insert the error message once the field "Balance Left On Credit", goes into minus. this field was calculated in the query "amount owed customer 3",

this also applies to the form "stock level 2 search", in the field "Qty_in_Stock", which again was a calcualted field.

I do not know if this helps, where i had a similar problem and was helped by
ADezii who's relpy is below with the question

how do you enable when making a order in the sub form called “all customer order details sub form” alter the error message when you put the same product in the same order.

currently in the all customer order details sub form”, i am mot allowed to enter products in twice for one order which is great. however the error message is automatic, and i want to edit this.
ANSWER
If I follow your logic correctly, you wish to replace the Standard Acces Error message with a custom one of you choice and not display the generic one from Access. To accomplish this, you must place code in the Form's Error() Event and place the proper value in the Response parameter.


Code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  2. Const conDuplicateKey = 3022
  3. Dim strMsg As String
  4.  
  5.   If DataErr = conDuplicateKey Then
  6.     Response = acDataErrContinue
  7.     strMsg = "Each employee record must have a unique " _
  8.              & "employee ID number. Please recheck your data."
  9.     MsgBox strMsg
  10.   End If
  11. End Sub
Have you got any tips, it will be much apreciated
thank you
Feb 16 '07 #12

Rabbit
Expert Mod 10K+
P: 12,366
This question and the question that ADezii answered is different in nature. In the question that ADezii answered, you were trying to bypass an existing error message within Access. What you are trying to do now is to create an error message that does not already exist.

I don't know your database so I can only give you general guidelines and hope you can run with that until someone who knows the specifics of your database can provide you with solid code.

In an event of your choosing, you'll have to check for the negative balance, if it's negative, then MsgBox "Error".
Feb 16 '07 #13

Post your reply

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