PC Review


Reply
Thread Tools Rate Thread

Can many controls use 1 macro?

 
 
=?Utf-8?B?Q2F0IFdpbnNsb3c=?=
Guest
Posts: n/a
 
      14th Oct 2006
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...)
 
Reply With Quote
 
 
 
 
Vinayak N
Guest
Posts: n/a
 
      14th Oct 2006

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

On Oct 14, 4:06 am, Cat Winslow <CatWins...@discussions.microsoft.com>
wrote:
> 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...)


 
Reply With Quote
 
Ken Snell \(MVP\)
Guest
Posts: n/a
 
      14th Oct 2006
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))


--

Ken Snell
<MS ACCESS MVP>

"Cat Winslow" <(E-Mail Removed)> wrote in message
news:80D3B9E7-C245-4FE3-8890-(E-Mail Removed)...
>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...)



 
Reply With Quote
 
=?Utf-8?B?Q2F0IFdpbnNsb3c=?=
Guest
Posts: n/a
 
      14th Oct 2006
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!

"Ken Snell (MVP)" wrote:

> 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))
>
>
> --
>
> Ken Snell
> <MS ACCESS MVP>
>
> "Cat Winslow" <(E-Mail Removed)> wrote in message
> news:80D3B9E7-C245-4FE3-8890-(E-Mail Removed)...
> >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...)

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB - Macro to list all controls in the Commandbar. LABKHAND Microsoft Excel Programming 8 8th Apr 2009 08:38 PM
setting OnAction macro names for form controls from a VBA macro jon Microsoft Excel Programming 5 10th Mar 2004 06:34 PM
Form Controls on a worksheet and Macro Peter M Microsoft Excel Programming 4 21st Feb 2004 02:12 AM
macro that copies controls =?Utf-8?B?TWVsYW5pZQ==?= Microsoft Excel Programming 2 2nd Jan 2004 04:16 PM
One macro for many controls? Don Wiss Microsoft Excel Programming 4 31st Dec 2003 01:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:54 PM.