Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Member Login

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Eng-Tips
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I train people in ACCESS. I make sure they know about these forums, give them some training on how to use the site, and have a shortcut to it on their PC's..."

Geography

Where in the world do Eng-Tips members come from?
jrice174 (Civil/Environmental)
13 Jul 07 12:51
I have many checkboxes on a form. If the user clicks on any one of them, I want to trigger an event (displaying a picture if the value is True). Is there a way to do this without having a procedure for each control?

Private Sub cbx1_Click()
End Sub

thru

Private Sub cbx30_Click()
End Sub
MiketheEngineer (Structural)
13 Jul 07 17:30
Can't exactly remember - but isn't there a KEYPRESS or MOUSE CLICK event that you can trap - possilby for the whole form??

Maybe this will trigger something for you..
MiketheEngineer (Structural)
13 Jul 07 17:44
In VB6-

The form has:
   MouseDown, MouseUp and Click

The Chkbox has:
   the same plus KeyDown, Keypress and Keyup

You should be able to trap on those

Good Luck
johnwm (Computer)
14 Jul 07 7:15
You probably need to iterate through the OLEObjects collection

CODE

For Each a In Me.OLEObjects
If Left(a.Name, 5) = "Check" Then
If a.Object.Value = True Then
MsgBox a.Name & " is checked"
End If
End If
Next

Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376: Eng-Tips.com Forum Policies before posting
Steam Engine enthusiasts
Steam Engine Prints

Regg (Mechanical)
14 Jul 07 11:53
If you are using VB6, you can create an control array and only have the code in one procedure.
johnwm (Computer)
14 Jul 07 12:18
As this is the VBA forum - and VBA doesn't support control arrays - OP may need the workaround I suggested. I agree it would be easier IF it was VB6

Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376: Eng-Tips.com Forum Policies before posting
Steam Engine enthusiasts
Steam Engine Prints

msmith (Materials)
4 Aug 07 18:06
This may be too late to help, but there is a way to create a single event procedure for multiple controls.  John Walkenbach explains how to do this on his "The Spreadsheet Page" website.  Here is the link to the specific topic page:  http://www.j-walk.com/ss/excel/tips/tip44.htm

The example code is set up for CommandButtons but you can change it to work with CheckBox controls.

Hope this helps.

Regards,
Mike
jrice174 (Civil/Environmental)
6 Aug 07 7:50
Fantastic! That is exactly what I was looking for. I love it. Thank you very much.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close