Results 1 to 5 of 5
  1. #1
    tpcervelo is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    28

    Smile Append query error trapping

    I have code that runs a number of queries resulting in a final table that will be appended to a linked business database. I want to give the user one final chance to say no so I am trying to intercept the NO reply from the append query message of "You are about to append nnn records".
    Following is my current code.

    Private Sub Upload_Click()
    Dim Response
    Response = MsgBox("Are you sure you want to upload", vbYesNo)


    If Response = vbYes Then
    Me!Text25 = "Uploading to Shop Floor"
    DoCmd.SetWarnings True
    DoCmd.OpenQuery "SF-0080-Upload Material"
    MsgBox "Upload complete", vbOK
    End If

    If I press NO then I get a Run-time error '2501', The OpenQuery action was cancelled. What I want to do is trap this and proceed to my normal cleanup.
    Any help is appreciated.
    Thanks
    Last edited by tpcervelo; 08-24-2010 at 12:58 PM.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Try adding an error trap:

    http://www.baldyweb.com/ErrorTrap.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tpcervelo is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    28
    Thank you Paul for the example...exactly what I needed.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    pwalter83 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    19
    Quote Originally Posted by pbaldy View Post
    Happy to help.
    Hi,

    Is it possible to help me on this one :

    https://www.accessforums.net/forms/e...html#post95185

    I am new to VBA and just going round and round with this.

    Thanks !
    Paul
    Last edited by pwalter83; 12-23-2011 at 04:30 AM.

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

Similar Threads

  1. append query
    By w_kenny in forum Access
    Replies: 2
    Last Post: 08-24-2010, 05:48 AM
  2. Append Query Error
    By lupis in forum Queries
    Replies: 1
    Last Post: 06-18-2010, 02:10 AM
  3. Append query won't append
    By yelkenli in forum Queries
    Replies: 5
    Last Post: 02-12-2010, 11:19 AM
  4. Append Query
    By cotri in forum Queries
    Replies: 1
    Last Post: 01-28-2010, 08:52 PM
  5. append query error
    By shashigk in forum Queries
    Replies: 2
    Last Post: 09-22-2009, 07:17 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