MS Access Forum / Forms Programming / August 2005
Undocumented error codes and Validation Rulw problems
|
|
Thread rating:  |
Reis Quarteu - 05 Aug 2005 14:34 GMT Hi, everybody. I'm new here. I would like to find someone out there who could give a hand in a bunch of errors I'm getting.
I am using Access 2003. I have a 9-fielded table with two Currency data type fields with their Validation Rule properties set to ">0". I have also set their Validation Text properties to meaningful Portuguese sentences. Then I have created a form bound to that only table. The two above mentioned fields are bound to two text boxes in that form, which in turn is embedded as a subform of another main form.
When I test my validation rules through the forms, by entering invalid data (negative numbers) into any of those two text boxes, the validation rules simply don't work. Instead, I get an undocumented 3316 error code (I simply can find no information about this runtime error nowhere, either offline or online, here in the MSDN) in the DataErr parameter of my subform's Error event. BTW, AccessError(3316) returns "|" (!?!?).
Aren't the validation text supposed to pop up when we enter invalid data at the form level?
I kept experimenting with it. If I rewrite the validation rule and text properties into the text boxes, now I receive the equally undocumented 7753 error code through the DataErr parameter of the subform's Error event. The only way I managed to get my validation text messages to pop up was to code them in the text boxes' BeforeUpdate events. It doesn't seem to be an intelligent way to use the Validation Rule and Validation Text properties.
I am losing too much time over this issue. If anybody out there can give me a helping hand, I would appreciate it very, very much.
Thanks for all your attention. Reis.
Wayne Morgan - 05 Aug 2005 14:54 GMT I just tried (using Access 2003) setting a rule in a table being used for a subform. The data type was Currency. When I entered a value in the subform that violated that rule and tried to tab out of the control for that field, I immediately received the error message I had typed in for the Validation text. If I tried to save the record without correcting the error, I again received the message because I had to move the focus from the control to do the save. However, if I tried to save the record from the Immediate Window (i.e. through code) I received an error message that stated "Run-time error '3316': My error message". Apparently the reason the error message for this error is blank is because it picks up your error message at the time it is invoked.
 Signature Wayne Morgan MS Access MVP
> Hi, everybody. I'm new here. I would like to find someone out there who > could [quoted text clipped - 39 lines] > Thanks for all your attention. > Reis. Reis Quarteu - 05 Aug 2005 15:35 GMT Hi, Wayne!
I'm sorry I could not get the same results as you. I have just done as you've said, but again I couldn't get no satisfying results: my problems remain the same. :-(
Isn't there any high-level configuration option that may be preventing the table-level Validation Text to pop up when appropiate? I have just scanned the Tools/Options but I could find no one...
Thank you very much for all your concern! Reis.
> I just tried (using Access 2003) setting a rule in a table being used for a > subform. The data type was Currency. When I entered a value in the subform [quoted text clipped - 7 lines] > error is blank is because it picks up your error message at the time it is > invoked. Allen Browne - 05 Aug 2005 14:57 GMT According to jetterr40.chm, error 3316 is: <Table-level validation text> and it means: A table-level validation rule was violated.
The pipe character is an internal indicator in Access, that it should insert something there. Presumably it is the Portugese sentence that it is supposed to insert in this case.
If this error is being triggered, then I presume the entry is not actually being saved in your table?
FYI, the JetErr40.chm file is found somewhere like this: C:\Program Files\Common Files\Microsoft Shared\OFFICE11\1033 and it can be useful to create a shortcut to it.
 Signature Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org.
> Hi, everybody. I'm new here. I would like to find someone out there who > could [quoted text clipped - 39 lines] > Thanks for all your attention. > Reis. Reis Quarteu - 05 Aug 2005 15:48 GMT Hi, Allen!
Thank you very much for your answer. I wonder why the files located in the folder referred to by you aren't seamlessly integrated in the Office Help, because there is a buch of very valuable information there. I took for granted that all the help files scattered over my disk were accessible from my IDEs. Unfortunately, I was wrong.
Since the error is being triggered, my wrong data is not being saved into my tables. Again, you're right.
But my main concern has still no answers: why is this happening to me? :-(
Thank you very much for your help! Reis.
> According to jetterr40.chm, error 3316 is: > <Table-level validation text> [quoted text clipped - 11 lines] > C:\Program Files\Common Files\Microsoft Shared\OFFICE11\1033 > and it can be useful to create a shortcut to it. Allen Browne - 05 Aug 2005 15:56 GMT So the validation rule is being honoured, but you are not seeing the message you should be seeing.
Do you have anything in the Error event of the form? If so, that event might be overriding the Validation Text.
If that's not it, it might be a language-related issue if others are not seeing it.
In any case, you might be able to work around it by trapping error 3316 in Form_Error, displaying the message you want with a MsgBox, and setting the Response argument to acDataErrContinue.
 Signature Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org.
> Hi, Allen! > [quoted text clipped - 32 lines] >> C:\Program Files\Common Files\Microsoft Shared\OFFICE11\1033 >> and it can be useful to create a shortcut to it. Reis Quarteu - 05 Aug 2005 16:39 GMT Again, you are absolutely right. In fact, I also have a Form_Error procedure because there are some other runtime errors I want to trap. I temporarily removed this sub, then entered invalid data into my text boxes, tabbed out of them, and voilà! my Validation Texts finally popped up.
Thank you very much for sharing your knowledge with me! :-)
Anyway, and now I am blaming Microsoft, I don't think it's very intelligent to force developers to retype validation texts that are already defined at the table-level for every control or form that needs these validation texts. What do you think about it?
Best regards! Reis.
> So the validation rule is being honoured, but you are not seeing the message > you should be seeing. [quoted text clipped - 8 lines] > Form_Error, displaying the message you want with a MsgBox, and setting the > Response argument to acDataErrContinue. Allen Browne - 05 Aug 2005 16:48 GMT Did you try setting Response to acDataErrDisplay in Form_Error if DataErr = 3316?
 Signature Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org.
> Again, you are absolutely right. In fact, I also have a Form_Error > procedure [quoted text clipped - 31 lines] >> the >> Response argument to acDataErrContinue. Reis Quarteu - 05 Aug 2005 17:39 GMT Dear Allen, THANK YOU VERY, VERY MUCH for all your kind help! It now works woonderfully! I've been fighting against this situation for two working days!
Again, Thank you very much for everything! Mais uma vez, Muito Obrigado por tudo! Reis.
> Did you try setting Response to acDataErrDisplay in Form_Error if DataErr = > 3316?
|
|
|