View Full Version : exit a form without it saving the info entered to table


xena_morph
03-13-2002, 10:05 AM
is it possible if youve filled part of a form in and change your mind to exit the form without it being saved to the table

JCross
03-13-2002, 10:29 AM
use me.undo to undo any changes to the form, or see the button wizard for an Undo button in record operations.

jennifer

xena_morph
03-13-2002, 10:44 AM
i ve been trying to do it with the

other > cancel set to yes but am not sure how to set up the acro to ensure it deletes whats added.

im not sure how to use the me.undo and cant seem to get the biutton wizard on argh

JCross
03-13-2002, 10:53 AM
why can't you get your button wizard on?

here is the code from behind a button wizard Undo button. you can just make a new command button and then make this the click event.

Private Sub cmdUndo_Click()
On Error GoTo Err_cmdUndo_Click

'undoes any changes that have been made
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70

Exit_cmdUndo_Click:
Exit Sub

Err_cmdUndo_Click:
MsgBox Err.Description
Resume Exit_cmdUndo_Click

End Sub

jennifer

xena_morph
03-13-2002, 10:59 AM
finally got button wizard to work which is brill
but was wanting to put macro on it to also exit as well as undo, it seems i can only get it to do one or the other not both by clicking the one button with the following macro:

openform
close
close

JCross
03-13-2002, 11:21 AM
it would be easier to just go into the code for the button click and docmd.close, yes?
if exiting the form on undo is what you want?

[This message has been edited by JCross (edited 03-13-2002).]

xena_morph
03-13-2002, 03:33 PM
not to sound too stupid but i dont know where in the coding that would go, could you please indicate where,

many thanks

xena_morph
03-13-2002, 03:36 PM
yeah i actually think ive figured out where it goes yeah!!!! problem is the table is still open behind it like

JCross
03-14-2002, 08:01 AM
what do you mean that the table is still open behind it. and if you go into the properties for the button, on the events tab, the on click event....then open up the code builder through the button on the right on the box it takes you the right place in the code.

jennifer

xena_morph
03-14-2002, 09:15 AM
i mean i click on the button to undo what is done on the form with the intention of also exiting at the same time but becuase the table was opened behind it originally to allow the form to store the info in it , it stays open on top

JCross
03-14-2002, 10:01 AM
I have absolutely no idea why you have the table open at all. It doesn't have to be 'open' to do anything with it. When you create a program to give to users, the whole purpose behind making forms is so that they don't have any access to the tables directly - and normally you would even hide the database window from them. Why is your table open?

[This message has been edited by JCross (edited 03-14-2002).]

xena_morph
03-14-2002, 10:51 AM
its open because every time i dont include it but have the function gotorecord -> new on it it wont work unless i havent got the table open in the background but then again at the moment it wont go to a new record fullstop

JCross
03-14-2002, 11:08 AM
have to admit i have no idea why gotorecord would need the table open. makes no sense to me. hopefully someone else will have an answer for you!

jen

[This message has been edited by JCross (edited 03-14-2002).]