Starting Over with Macros

  • Thread starter Thread starter Uschi via AccessMonster.com
  • Start date Start date
U

Uschi via AccessMonster.com

I created a database where I had a macro bring up a msg box (Read this
message - click OK) and then open the form. I had another macro that when the
user clicked the close button on the form a msg box (Back Up Reminder) would
appear.

When the database changed I no longer needed the msg box before opening the
form so I deleted it.
Big mistake. Now nothing works.

Is it possible to just start over and if so, how?
 
Uschi,

You will certainly be able to get things working as you want them, so I
can say 'Yes' to that.

Apart from that, I think we would need some more detailed information,
before anyone could offer any specific advice. For example, what does
"nothing works" mean? What are the actions in your macro now? What
exactly did you delete?
 
Many thanks for quick reply.

Originally, I had two Macros. One to bring up a msg box when the user opened
the ShareCertificate form from the Switchboard. The other brought up a
Reminder to Back Up msg box when the user closed the ShareCertificate form.

When I no longer needed the msg box when the user opened the ShareCertificate
form I deleted the Macro from the database window. When I did that I couldn't
open the database. I tried to reconstruct the macro so I could open the
Switchboard. It still wouldn't work properly. When I put a Stop Macro on it
the Switchboard would open.

Currently, opening the Switchboard brings up different results; sometimes the
Reminder Msg box pops up when the user clicks on the forms button and
sometimes the forms button doesn't work at all. The only way I think I can
stop this behavior is to put a Stop Macro on it.

I would like to delete the macros altogether. Doesn't it make more sense to
put my msg box on the On Click properties of the close button?
 
Uschi,

Can you please give the names of the macros, what are the actions of the
macros, what events are the macros assigned on, and explain what is the
behaviour that you actually want. Thanks.
 
Hi Steve,

I currently have three macros:

*AutoExec -
Open the Switchboard

*Current Membership Reminder (Stop Macro)-
MsgBox
Open the ShareCertificates form

*Reminder -
MsgBox
Close the ShareCertificates form

I put the msgbox on the Exit property of the Close Database button on the
Switchboard. This is all I really need.

Is it possible to delete the macros without corrupting my database?
 
Uschi,

Yes, you can delete macros from your application. However, as well as
deleting the actual macros themselves, you will need to remove all
references to them. That means any event properties where the macro was
originally assigned, you need to delete the macro name from these events.

It would be unusual, and probably not a good idea, to use the Exit
property of a command button. Normally the button's Click event is the
one to use.
 
Hi Steve,

I deleted the three macros from a copy of my database. I cannot find any
references to them in the property sections of the controls. Now, when I open
up the Switchboard and click on the Forms button an error message pops up
"There was an error executing this command."

Is there somewhere else I should be looking for those references?

Also, regarding you statement about placing the msgbox on the Exit property,
I am a total novice at this and don't know why one is better over another.
That being the case, would you help me write a code for the On Click property.
Currently, I have the following:

MsgBox "Back Up is STRONGLY recommended after each session.", vbExclamation,
"Reminder"
Exit Sub

Many thanks,
 
Uschi,

In order to figure out what's the cause of the error message, we would
need to look at what is happening when you click the Forms button. Can
you have a look at the Properties for this button, and see if there are
any entries in the event properties (for example, the On Click, On Dbl
Click, On Exit, etc properties. If there are, can you please reply back
with the exact details of these entries.

A commnd button's Click event happens when you click on it. Its Exit
event happens when the focus moves away from the button to another
control on the form. If you want an action to take place when you click
the button, then it is the Click event that is applicable.

Regarding:
MsgBox "Back Up is STRONGLY recommended after each session.",
vbExclamation, "Reminder"
Exit Sub
.... this is not a macro. This appears to be part of a VBA procedure.
Where do you actually see this code? Is that the *entire* code there,
or is this just part of it?
 
Hi Steve,

I have looked at the Properties for this button and cannot find a thing.
Fortunately, I deleted the macros on the test copy.

That being the case I am wondering if I should just leave things as status
quo on the good copy (not to delete the macros until I I figure this thing
out) and work on the code for the On Click Properties of the Close Form
command button instead.


This is the VB code on the Exit property of the Close Form command button:

Private Sub Command56_Exit(Cancel As Integer)
MsgBox "Back Up is STRONGLY recommended after each session.",
vbExclamation, "Reminder"
Exit Sub

End Sub

I know I need something else in it to allow the button to close the form.
Sorry, I need help with this. I just don't know enough about writing code.

Your help is very much appreciated.
Uschi
 
Back
Top