Macro vs VB Code Issue with Data Error

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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?
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Staff online

Top