simple 'close' question

G

Guest

I have a command button on a form that is intended to close the form without
saving the record. It's attached to a simple close macro with the save
argument set to no. While it closes the form, it's saving the records,
anyway. What's up with that? And how do I get it to stop?
 
T

tina

the Save argument is referring to changes in the *form object*, NOT the data
in the current record. if you want to close a form without saving changes to
the current record, you need to program the Close button specifically to
prevent it. something along the lines of

Me.Undo
DoCmd.Close

hth
 
G

Guest

Fresh trouble.
I added the undo action before the close action, as you suggested. Worked
great on the first five trials. Then I added it to additional forms (no
object specified in the close action) and it suddenly began generating a
"command or action 'undo' isn't available now" error. This error is also
generated on the form that was originally tested. Any idea what's up?
 
S

Steve Schapel

Hbear,

I think you will get that error if there is nothing to "undo", in other
words if there have been no new data or edits on the form. Does that
seem like it might apply to your situation?
 
G

Guest

I considered that and tested with and without entering new data. It fails in
both cases.
 
S

Steve Schapel

HBear,

Ok, and the command button is on the form that the data controls are on,
right? I mean, we don't have subforms here, do we, or unbound forms?
And the Undo is coming before the Close action in the macro, right?
Well, if so, I am sorry to say that I can't think of any explanation here.

If it's still giving trouble, maybe you should re-post in a new thread,
or in another newsgroup (e.g. microsoft.public.access).
 
G

Guest

Yes to each of your questions. (But no to the subforms/unbound forms).
Haven't solved the problem yet, but I'll look everything over again and give
it another try. Thanks for your suggestions. At least I know where to focus
my efforts.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top