Can many controls use 1 macro?

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

Guest

I have a number of text fields (for various reasons, many must be able to
default to Null) which are set up to allow Y or N. I created a macro that
allows Y or N input, and changes it to Yes or No. I want to run the same
macro steps, though, from about 15 fields on my form. Is this possible? It
looks like I have to include the specific control name, but Shirley I must
not have to create 15 macros...

Thanks in advance! (and be gentle, I am already partly fried...)
 
Hi,

I don't know if this would be of any help to you but just in case...

Microsoft Access Macros

Attribute

Maximum
Number of actions in a macro
(macro: An action or set of actions that you can use to automate
tasks.) 999

Number of characters in a condition
(condition: Part of the criteria that a field must meet for searching
or filtering.
Some conditions must be used with a value; for example,
the field Author with the condition equals with the value Jane.)
255

Number of characters in a comment
255

Number of characters in an action argument
(action argument: Additional information required by some macro
actions.
For example, the object affected by the action or
special conditions under which the action is carried out.)
255


Regards,
Vinayak
 
Assuming that you use the AfterUpdate event of each textbox to run the
macro, you may be able to use a single macro. It's actions would be this:

Action: SetValue
Control Name: Screen.ActiveControl.Name
Expression:
=IIf(Screen.ActiveControl.Value="Y","Yes",IIf(Screen.ActiveControl.Value="N","No",Null))
 
Wooooohooooo!!
I had to split the setvalue into separate lines, but it works! I have been
struggling with piddly things like this for quite a while, and it feels great
to get one figured out. I looked all over for that syntax, but of course if
you don't know what it is it's hard to look in the right place.Thanks for
your help!
 
Back
Top