Results 1 to 3 of 3
  1. #1
    Eliza31 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    1

    Cancel a prompt query (in macro) without macro error window

    Hi all,
    I need help to turn off the GUI window when a macro hits an error. Here's the situation. I have a query that prompts the user for information. If they decide not to complete the selection, (the selection criteria window you get with a prompt has a cancel button automatically) and the query is running in a macro, the macro error window opens and you have to click stop macros. This is not very user friendly when you are creating a client component in a database. I want to know how to stop this message from showing. (I already have setwarnings to no, but Microsoft overrides that when it gets an error). I've tried 15 variations from Sunday and none of the stopmacro commands or other commands seems to be able to override that window. Here's the thing, if Microsoft is nice enough to give you a "OK" or "Cancel" button on the prompt window, why can't they capture the cancel command in the macro?

    Any code around that I can use here?



    Thanks,

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    I don't use macros, only VBA, more versatile and more control over behavior. What kind of SQL are you running - INSERT, UPDATE, DELETE?

    I also don't use query input parameter prompts, can't validate input. I have users input into controls on form and query references controls or I use VBA to build WHERE clause of DoCmd.OpenForm (or OpenReport). If valid, then run code.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    bcmarshall is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    95
    I've written many very sophisticated databases using nothing but macros, but I've never seen a way of overriding the display of a failed command message. What you're not clear about is how you generate the box with the cancel button, and the overall functionality of what you're trying to accomplish. Maybe with more info we can help.

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

Similar Threads

  1. Macro export to excel error
    By Andy_d in forum Import/Export Data
    Replies: 7
    Last Post: 04-15-2011, 09:54 AM
  2. VBA to cancel a macro
    By GraemeG in forum Programming
    Replies: 1
    Last Post: 03-26-2011, 04:50 PM
  3. Replies: 0
    Last Post: 01-12-2011, 12:43 PM
  4. Replies: 2
    Last Post: 09-30-2009, 09:40 AM
  5. error in macro
    By nawaray in forum Access
    Replies: 0
    Last Post: 02-10-2009, 12:06 PM

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