Two macros at once?

1jet

Registered User.
Local time
Today, 16:32
Joined
Sep 15, 2008
Messages
117
Hi all,

I've tried the search but no luck.
I have a form with TWO save buttons (one's just to save, the other to save then close). Each have been "disabled" and EACH have a macro to "enable" them when the form "is dirty."

Problem is, I don't know whether the "on dirty" event of the form can have TWO macros.

So, I tried using just ONE macro to "set value" my two buttons to "enabled."

Now, when I dirty the form, neither button is enabled.

Help?
Thanks in advance.
 
a. Put the macro actions that enable the buttons one after ther other in the same macro.

b. Use vba code (preferred :) )
 
a. Put the macro actions that enable the buttons one after ther other in the same macro.

b. Use vba code (preferred :) )

Yeah my macro had two separate "set values." One to each button.

I've never used vba code before.
Any good sites where I can quickly pick up some basics?

Cheers
 
Yeah my macro had two separate "set values." One to each button.

I've never used vba code before.
Any good sites where I can quickly pick up some basics?

Cheers

I have found that (using Access 2003 and Access 2007) VB almost teaches itself. Once you learn the main keywords, the hints will get you rolling right along. In the mean time, I have found sopme very useful examples, hints, and advice

HERE: http://www.access-programmers.co.uk/forums/forumdisplay.php?f=63

If that link is not enough, you can always try

HERE: http://www.access-programmers.co.uk/forums/

In other words, some of the best advice I have encountered has been here on AWF. Good luck in learning VB.
 
So when you had just one it worked?

You know what, now it doesn't work at all!
Even if I try just the ONE button.
I'm going to rip out my hair soon.

I've made sure the form has "mcrNewEmployeeIsDirty" on the "on dirty" event.
I've made sure the save button on the form is called "cmdNewEmpSave" and that it's disabled.
I've made sure the macro has "set value" YES to [cmdNewEmpSave].[Enabled].

Do I have to have a record source for the form?
 
The best thing to do is use code. Something like:

forms!myFormName!myControlName.Enabled = False
 
The best thing to do is use code. Something like:

forms!myFormName!myControlName.Enabled = False


You know this is really weird.
Don't worry about coming back to this post again.

For another one of my forms "frmEditEmployee" (just now we were on frmNewEmployee), I had the same "on dirty" events and buttons.

I tested it out, works fine. Make a change to the macro, change it back to how it was originally, and now it doesn't work anymore.

I'm going to reboot.
:mad:
 
Theres a good feature built into Access to learn a bit of VBA from Macros...Under "Tools"..."Macro"... click "Convert forms macros to visual basic" Do this for one of your buttons and you should be able to see where to add another line of code for your second button..duplicating the first as an example.
 
where is an "on dirty" event

what event are you actually using?
 
Gemma,

Hope not being too presumptmous, but I think he meant Dirty event; OnDirty is an property of form where you add "[Event Procedure]", a function name or something like that.
 

Users who are viewing this thread

Back
Top Bottom