Conditional Macro

  • Thread starter Thread starter Kay
  • Start date Start date
K

Kay

Hi,

I would appreciate help with a macro in Access 2003. I have a subform where
the user picks from a drop-down a certain value, but the bound field does not
show...example, 1000 is the bound field value, but Compensation shows in the
field. I need a msgbox to appear if one value is chosen and another msgbox
to show if another value is chosen. I created a macro with a condition[
PymtID] = "compensation" or "Marketing" or "Education". The action is a
msgbox that pops up to tell them to add payment details. I also need a
different msgbox to pop up if the choice is "Other". First, do I use the
value that shows in the field or the value that is stored in the field in my
condition. I have tried it both ways, but the macro fires regardless of the
choice I have in the field. I tried placing the macro on the after update
event and then the on exit event of the PymtID field. What am I doing wrong?
 
Kay,

I think the After Update event of the PymtID combobox would be the best.

You need to use the actual value, rather than the associated displayed
value. Therefore I believe the Condition for the first MsgBox action in the
macro should be like this:
[PymtID]=1000 Or [PymtID]=1001 Or [PymtID]=1002
(... or whatever your actual numerical values for Marketing and Education
are).
 
Steve,

Thanks! I did get it to work with in(1000,5000,6000). I did not realize
you needed to reference the field for each "Or" so that is good to know. The
second condition fires as well, at least once I changed that to it's numeric
code. Thanks so much.
 
Back
Top