help on Microsoft access 2003 re marco's

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am hoping you can help me!

I have a table ( for example ) with a field name "FOOD STUFF" , which has a
look up list from another table.
I have created a form which has the text box ( so actually a Combo box), so
I can select from the drop down list.

Say I have 3 Items in the drop down box called...

ITEM SUGAR
ITEM SALT
ITEM TEA BAGS

I can "select" or "type" from List, and tab/move on to the next field in the
form.

But....

I want to before moving on ( or as I move on, of just after ..but before I
enter data in the next field ) trigger one of 3 Different Macros depending
on with of the 3 Items I finally selected.

I.e

ITEM SUGAR triggers/executes a macro called Macro 1 ( for example).
ITEM SALT triggers/executes a macro called Macro 2 ( for example).
ITEM TEA BAGS triggers/executes a macro called Macro 3 ( for example).

That's all !
 
you can call a *single* macro from the control's AfterUpdate event, and use
the Condition column in that macro to tell Access which of the three other
macros to run. example:

<first line of macro>
MacroName: RunOne
Condition: ComboboxControlName = "SUGAR"
Action: RunMacro
MacroName: Macro1

<second line of macro>
MacroName: <leave blank>
Condition: ComboboxControlName = "SALT"
Action: RunMacro
MacroName: Macro2

<third line of macro>
MacroName: <leave blank>
Condition: ComboboxControlName = "TEA BAGS"
Action: RunMacro
MacroName: Macro3

having said that, chances are good that the condition i posted will not
work - IF your tables includes a Lookup field, as i suspect from your posted
description. Lookup fields in tables are nothing but trouble (for more
information, see http://www.mvps.org/access/lookupfields.htm) and i strongly
recommend that you change the Lookup field in your table to a "normal"
field. there is absolutely nothing wrong with using a combo box control in
your *form*; however. the issue is that the table used to supply the
droplist values may very well have a numeric primary key, and a second field
which lists the "sugar, salt, tea bags" values. if so, then the conditional
expressions above must refer to the numeric values for each record, rather
than the text values. (this is not really so hard, but it's murder to try to
explain in print, especially since i can't see your db. sorry if it confuses
you!)

hth
 
Back
Top