More than one Macro?

erbarmen

Registered User.
Local time
Today, 14:23
Joined
Dec 6, 2007
Messages
11
Hello.
Can I set more than one Macro in the AfterUpdate sector of a Control, in a Form?

Thanks
 
You can create a macro that runs multiple macros and then set THAT one as the macro to use in the event.
 
Macro Group

Great. So I found out how to create a Macro group.

I have the following two Macros:

Macro1
SetValue
Item: [LineTotal]
Expression: CCur([UnitPrice2]*[Quantity]*(1-[Discount])*(1+[SalesTax]))

Macro2
SetValue
Item: [UnitPrice2]
Expression:=[Product ID].[column](2)

Then I have the following Macro Group:

MacroGroup1

1)
RunMacro
MacroName: Macro2
2)
RunMacro
MacroName: Macro1


In my "Order Details" form, I have a [Product ID] combo box.
Column 2 of the [Product ID] combo has the Unit Price (this explains Macro 2).

Now,

In the AfterUpdate of the combo box I entered MacroGroup1

When I run the form, and I select a different value from the [Product ID] combo box, UnitPrice is updated, but not LineTotal. (???)
In other words, action 1) of Macrogroup1 is done, but not 2).

Why is this?:confused:
 
Are you sure you have 3 fields in your combo box? If you only have 2 then the syntax is

=[Product ID].[column](1)

because columns in combos are ZERO BASED.
 
No, that's not the problem. I have three fields (column one is ProductName).
Thanks for the tip, though. I'm new to access.
 
It's been so long since I've used macros (stopped using them in 2000 after working on learning VBA), but I noticed you have no = sign in the first one and the = in the second. What happens when you remove it?
 
mmm... I'd like both the UnitPrice and the LineTotal to update when I change the Product ID.

Should I used other types of events (e-g- BeforeUpdate, etc...). I'm really new to this, so I don't know much.
 
Maybe if I only set Macro2 in The AfterUpdate event of the combo box.
The I could set another event in the UnitPrice control. But, what type of event?
 
I'd follow Bobs advice and jump into VBA..... Your using Macros... If you have some on this project that work use the option to "convert Macros to VBA" Then you can examine the code that is created. It's a great way to start learning VBA.
 

Users who are viewing this thread

Back
Top Bottom