1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Macro vs VB Code Issue with Data Error

Discussion in 'Business Applications' started by punster, Jan 25, 2005.

Thread Status:
Not open for further replies.
  1. punster

    punster Thread Starter

    Joined:
    Dec 23, 1999
    Messages:
    33
    With code in the Form_Error event, I am able to capture and control the error if the user uses the navigation buttons. Also if the user clicks a command button where I have the VB code of docmd.quit, I am able to display my message followed by an access message, followed by the message of "can't save record do you want to leave database anyway" which is an acceptable way for me to handle the error - the user can click no, and the form with the bad data is still in the active window state. Now if on the click event to go to another form, I run a macro with warnings set to no, echo off, close existing form and open new form, I will get my message, the access message, and then if the user clicks the "no" on the exit database question, the "Action Failed" box from the macro pops up (and from what I have read, there is no way to prevent that) - and the user must click the "halt" button to return to the form with the bad data. However, if I try to put the code from the Macro into Visual Basic - docmd.close followed by docmd.openform, no error messages appear, the form just closes and the other form opens.

    I would like to avoid getting the Macro Action Failed/Halt Message Box, be able to control the error from visual basic so that the user is returned to the form with the bad data and has the option to either correct the data or escape out of adding the new record. Can't figure out why it works on the docmd.quit but not on the docmd.close.

    Is what I want to do possible, and if so how?
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/323252

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice