Click Event Procedure

  • Thread starter Thread starter Sondra
  • Start date Start date
S

Sondra

I have an edit form that I want to create a command button
on that will close the form and reopen it. The reason
being that the form is run on a criteria query that asks
the user to enter the document number they want to
update. I wrote a macro that closes the form and reopens
it, and that seems to work, but I would prefer to have an
onclick function.

Any help would be appreciated.

Thanks.

Sondra
American Red Cross
Give the Gift of Life Donate Blood
 
I've been designing for years but unfortunately I'm a newbie at running
code.

One thing I do to learn different code is create the macro like you did,
then save it. After that I right click on the macro, select export and
then select Module.

After that I do to the module open it (same name as macro) copy the code.

Then I go to my form click to create a command button, select cancel, open
the properties of the command button, name the command button first then go
to event select event procedure hit the ... dots to open the visual basic
editor and paste the code in there.

The code for something similar that you are talking about I believe is this.

DoCmd.Close acForm, "Form1", acSaveYes
DoCmd.OpenForm "Form1", acNormal

Place it wherever you need. It could be on click, after update, or after
exit.

If you give more detail on what exaclty you are doing you say it runs from
a criteria query and then they are editing a document number, do you mean
to open another form? Unclear.
 
Back
Top