A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Group Controls For One Event



 
 
Thread Tools Display Modes
  #1  
Old March 24th, 2010, 04:06 PM posted to microsoft.public.access.forms
Microsoft Access
external usenet poster
 
Posts: 14
Default Group Controls For One Event

I would like to be able to group a bunch of text boxes on my form so that if
something changes in any of them I can use the onchange event for the group
and not have to add code for all textboxes. Is this possible? Thanks.


  #2  
Old March 24th, 2010, 05:24 PM posted to microsoft.public.access.forms
Maurice
external usenet poster
 
Posts: 1,585
Default Group Controls For One Event

There are different ways to achieve that. Are the specified controls al
textboxes or.. what makes the distinction.

The 'tag' property of the control is often used for checking groups of
controls.

Example:

alle the controls that have "hide" in them should be hidden after a certain
action.
set every tag of the specified controls to "Hide" and then the following
under the event handler
code:

dim ctl as control
for each ctl in me
if ctl.tag="hide" then
ctl.visible=false
else
'you could do something alternative here otherwise leave the else out
end if
next


hth
--
Maurice Ausum


"Microsoft Access" wrote:

I would like to be able to group a bunch of text boxes on my form so that if
something changes in any of them I can use the onchange event for the group
and not have to add code for all textboxes. Is this possible? Thanks.


.

  #3  
Old March 24th, 2010, 05:54 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Group Controls For One Event

On Wed, 24 Mar 2010 11:06:14 -0400, "Microsoft Access"
wrote:

I would like to be able to group a bunch of text boxes on my form so that if
something changes in any of them I can use the onchange event for the group
and not have to add code for all textboxes. Is this possible? Thanks.


Watch out: the Change event's name is a bit misleading. You may want the
AfterUpdate event instead - the Change event fires at every keystroke,
AfterUpdate when a new value has been entered and the user leaves the control.

That said... no, you can't do this directly, but you can create a Function in
the form's module, and put

=FunctionName(arguments)

in place of [Event Procedure] in the appropriate event of each textbox.

--

John W. Vinson [MVP]
  #4  
Old March 24th, 2010, 06:02 PM posted to microsoft.public.access.forms
Microsoft Access
external usenet poster
 
Posts: 14
Default Group Controls For One Event

Thanks Maurice, that is an interesting solution. It wouldn't work here
because I am looking for an event to fire, but I think John addressed this
case. I will keep this idea in mind for the future though.

"Maurice" wrote in message
...
There are different ways to achieve that. Are the specified controls al
textboxes or.. what makes the distinction.

The 'tag' property of the control is often used for checking groups of
controls.

Example:

alle the controls that have "hide" in them should be hidden after a
certain
action.
set every tag of the specified controls to "Hide" and then the following
under the event handler
code:

dim ctl as control
for each ctl in me
if ctl.tag="hide" then
ctl.visible=false
else
'you could do something alternative here otherwise leave the else out
end if
next


hth
--
Maurice Ausum


"Microsoft Access" wrote:

I would like to be able to group a bunch of text boxes on my form so that
if
something changes in any of them I can use the onchange event for the
group
and not have to add code for all textboxes. Is this possible? Thanks.


.



  #5  
Old March 24th, 2010, 06:03 PM posted to microsoft.public.access.forms
Microsoft Access
external usenet poster
 
Posts: 14
Default Group Controls For One Event

Thanks John, I will do what you said about adding the function to the event
in properties. Thanks for the thoughts.

"John W. Vinson" wrote in message
...
On Wed, 24 Mar 2010 11:06:14 -0400, "Microsoft Access"
wrote:

I would like to be able to group a bunch of text boxes on my form so that
if
something changes in any of them I can use the onchange event for the
group
and not have to add code for all textboxes. Is this possible? Thanks.


Watch out: the Change event's name is a bit misleading. You may want the
AfterUpdate event instead - the Change event fires at every keystroke,
AfterUpdate when a new value has been entered and the user leaves the
control.

That said... no, you can't do this directly, but you can create a Function
in
the form's module, and put

=FunctionName(arguments)

in place of [Event Procedure] in the appropriate event of each textbox.

--

John W. Vinson [MVP]



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:26 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.