Results 1 to 9 of 9
  1. #1
    shylock is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2018
    Location
    Dayton, Ohio
    Posts
    100

    Suppres error messages

    Hi All.



    This I probably a stupid question. Is there a way to suppress error messages in Access? I'm getting an error shown below. I want to bypass or ignore this error as my program does save the record without any nulls.

    Click image for larger version. 

Name:	Error Saving.PNG 
Views:	21 
Size:	30.7 KB 
ID:	36329

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    docmd.setwarnings false

  3. #3
    GinaWhipp's Avatar
    GinaWhipp is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jul 2011
    Location
    Ohio, USA
    Posts
    377
    Hmm, while ranman256 is correct, I would be careful about shutting them off (and don't forget to turn back on DoCmd.SetWarnings True) as if there is a legitimate message it too will be stifled.

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742
    You can also test for certain error messages and take an action you control.
    See this by PBaldy.
    I would not blindly/unconditionally suppress error messages

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    you can also use the

    currentdb.execute (SQL statement here)

    this doesn't pop up with append errors when you run it but functions exactly like an append query otherwise, in other words it won't overwrite existing indexed records (either by primary key or unique key field(s))

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,991
    The previous suggestion also means no error messages will appear of any kind

    Better still use Currentdb.Execute (SQL statement here), dbFailOnError
    This will run all your action queries without messages BUT if the query fails it will display an error message

    Personally I would use the above together with proper error handling like that in the link supplied by orange
    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

  7. #7
    shylock is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2018
    Location
    Dayton, Ohio
    Posts
    100
    Thank you for a great suggestion. I think this is exactly what I'm looking for. Normally, I would change my code to avoid the error altogether. However, I know what is causing it. The table has separate fields for dates and times instead of date/time fields. For this application I cannot combine them into date/time fields. Even though the error pops up the record gets saved properly, without nulls. "If it ain't broke don't fix it."

    Thanks again.

  8. #8
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742

  9. #9
    shylock is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2018
    Location
    Dayton, Ohio
    Posts
    100
    Quote Originally Posted by orange View Post
    Please explain.

    I just find it easier to work with a separate date and separate time field. Personal preference.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Error code to prevent error messages
    By sanal in forum Programming
    Replies: 11
    Last Post: 05-09-2018, 11:29 AM
  2. Error messages
    By Lou_Reed in forum Access
    Replies: 8
    Last Post: 12-08-2016, 11:34 PM
  3. How to handle error messages?
    By yes sir in forum Access
    Replies: 3
    Last Post: 10-15-2011, 11:22 AM
  4. Custom messages to Access' default error messages.
    By evander in forum Programming
    Replies: 1
    Last Post: 06-26-2010, 02:06 AM
  5. Error Messages
    By DataGeek in forum Access
    Replies: 0
    Last Post: 12-06-2007, 09:56 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