Page 1 of 4 1234 LastLast
Results 1 to 15 of 56
  1. #1
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658

    Error handling during entry

    I posted about error handling during data entry in another forum, (if I recall correctly).


    Mostly, it was about how to handle before update errors.
    The general consensus was to have a pop-up form display the errors.

    I'm getting back into the error-handling for my template form,
    and I'm wondering if there is a better way to handle this kind of error (and all the others like it)?

    Click image for larger version. 

Name:	221115Errm.jpg 
Views:	32 
Size:	25.1 KB 
ID:	49118

    I've got multi-language in the app, and want to display a better error message than the standard Access one, in different languages.
    Any suggestions? Like how to intercept the error and how best to create your own pop-up?
    Thanks

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    If you are dealing with a relatively limited set of likely error codes you could store them in a table with a procedure to use a customised message form and also use the same table to return multiple languages options.
    You would need to trap the errors on each form and provide a suitable error handling routine to pick up the customised messages.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    Quote Originally Posted by Minty View Post
    If ...
    You would need to trap the errors on each form and provide a suitable error handling routine to pick up the customised messages.
    Yes, but I'm not sure of the proper technique for trapping an entry error in a form textbox, just after it's been entered and stopping the Access error message.
    Is it more complicated than just after-input?

  4. #4
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Probably in the before update property, that allows you to cancel the update, and capture the error.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    Might as well grab a table of all errors rather than try to guess which ones could arise? Lots of formats for complete (?) error listings. Here's one that is already in db form - could be an add-in or a referenced db. You might then have a db for every language and pair one of those with the main db for that language. Who knows, you might even find listings in other languages and save yourself the interpretation effort.

    http://www.fmsinc.com/microsoftacces...scription.html
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658

    Must be another way

    Quote Originally Posted by Minty View Post
    Probably in the before update property, that allows you to cancel the update, and capture the error.
    I tried all the logical events, none triggered before the Access error msg popped up for an invalid date entry.
    I'm guessing there must be a way to turn off error checking in a universal way.

    Another example is entering a first name (required) At the moment of entry, maybe only the last name is available, so we want to tab quickly to that field, and return to fist name later. In my tests this works and fails not at entry time, but during save. I'm guessing I'll be busy trying to figure out when Access wants to immediately validate entry or not.

  7. #7
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    I'm guessing there must be a way to turn off error checking in a universal way.
    Did you ever research the subject? Lots of pages out there.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    Quote Originally Posted by Micron View Post
    Might as well grab a table of all errors rather than try to guess which ones could arise? ...
    Thanks, but these seem to be the errors that pop up from VBA code. As best as I can tell, data entry errors (in textboxes) are handled differently.

  9. #9
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    As best as I can tell, data entry errors (in textboxes) are handled differently.
    I don't think so, unless you've created special error handling situations or impose your own constraints at run time. If you set a table field as required/no dupes and the field is empty when I try to save the record, that is a system error and it has its own number and descriptive text. Besides, you can create your own error numbers/messages and raise them if there are no built-in ones that fit the requirement so the table idea still has merit IMO.

    Can you reveal a textbox error message that is "handled differently" (I don't know what that means). An error is an error, and whatever it is, there is a number for it. Sure, often they are somewhat cryptic but sometimes lack of experience is the limiting factor.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #10
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Agree with @Micron & @Minty. All errors trigger the same type of response
    In case it helps, see my example database: https://www.isladogs.co.uk/access-er...des/index.html
    Or this article provides codes to create your own errors table: https://www.isladogs.co.uk/access-er...ist/index.html
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  11. #11
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115

  12. #12
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    Quote Originally Posted by Micron View Post
    Did you ever research the subject? Lots of pages out there.
    Yes, I did my best with the Access vocabulary I have. I could only find results that dealt with VBA run-time errors, not textbox entry errors.

  13. #13
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    Quote Originally Posted by Micron View Post
    ...
    Can you reveal a textbox error message that is "handled differently" (I don't know what that means). An error is an error, and whatever it is, there is a number for it. Sure, often they are somewhat cryptic but sometimes lack of experience is the limiting factor.
    Yes, see the image in the first post. That's not a VBA run-time error.

  14. #14
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    Quote Originally Posted by Gicu View Post
    I would suggest you try to trap it in the Form_Error event:

    ...
    https://www.tek-tips.com/viewthread.cfm?qid=1023699
    ...

    Cheers,
    Thanks, it seems this question has stumped a lot of experts. I'll dig into RoyVidar's approach. Thanks for the link.

  15. #15
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    The errors are just errors. While an error may only occur due to running code, unless I'm mistaken, that doesn't matter - all errors are in any complete list. Not saying that they're all helpful - such as "Application defined or object defined error" - about the most cryptic Excel error I've seen, and worse, the same number seems to be used with various descriptions.

    Your post image is error 2113, and it is in the list.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Page 1 of 4 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 11-14-2021, 10:44 AM
  2. Error Handling: How to Skip an expected Error
    By Sa'El in forum Programming
    Replies: 2
    Last Post: 01-17-2016, 05:04 PM
  3. Replies: 5
    Last Post: 09-06-2015, 12:06 PM
  4. Error Handling Question - On Error Goto
    By redbull in forum Programming
    Replies: 7
    Last Post: 12-06-2012, 07:54 AM
  5. Replies: 3
    Last Post: 09-05-2012, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums