Results 1 to 3 of 3
  1. #1
    Patrick1977 is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    6

    Add warning messages to a form


    Hello,

    I have a database that is importing and manipulating a bunch of text files.
    I have a form with several buttons that implement the import and processing steps.
    During the import steps, there are several message boxes that pop up saying: "Microsoft Access was unable to append all the data in the table." and describes 'key-violations' and ask if I want to proceed.

    I would like these messages to be added, in order, to a subform and for the message boxes to not appear, but accepted.

    Does anyone know how to do this?

    I suppose it is a matter of grabbing the messages, and adding those to a table that can be shown as a subform on the main form. Using VBA, how do I grab the messages and automatically accept them?

    Thank you for any insight.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    I didn't test this but you'd want something like this to trap the errors, not sure if the resume next will force the acceptance or not but it might.

    Code:
    sub whatever()
    dim smsg
    
    On Error GOTO ERRHANDLER
    
    'do your stuff here
    
    me.NOTICEFIELD = smsg
    
    exit sub
    
    ERRHANDLER:
    smsg = smsg & err.number & err.description & vbcrlf
    resume next
    
    end sub
    EDIT: if you're trying to trap the '0 records added 1 record ignored ' I don't think you can, those are part of the database engine of MS access, I could be wrong, and frequently am and someone can correct me if I am.

  3. #3
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    See attached zip file. It shows how to create an error log file (table) and how to show or not show users the error messages as they occur. You can probably adapt it for your use. It also includes a report to show the error log.
    Good luck,
    UpRider
    Attached Files Attached Files

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

Similar Threads

  1. Warning messages trusted
    By Jen0dorf in forum Access
    Replies: 1
    Last Post: 03-04-2016, 03:37 AM
  2. Remove WARNING messages?
    By taimysho0 in forum Queries
    Replies: 4
    Last Post: 12-14-2011, 05:06 PM
  3. Warning messages
    By Bobcoop103 in forum Access
    Replies: 3
    Last Post: 08-12-2010, 11:45 PM
  4. Review Date on A Form Warning
    By maintt in forum Forms
    Replies: 3
    Last Post: 07-19-2010, 02:28 AM
  5. Custom messages to Access' default error messages.
    By evander in forum Programming
    Replies: 1
    Last Post: 06-26-2010, 02:06 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