Image buttons: how to get multiples?

ttomw

Registered User.
Local time
Yesterday, 17:13
Joined
Apr 13, 2012
Messages
26
I am trying to get multiple image buttons behaving on an Access 2003 form.
Following is a little bit of the code. The rest is in the sample DB attached. It works for the first command button, but not additional ones on the form:

Public Sub InitButtons(Form As Form)
Dim ctrl As Control

For Each ctrl In Form.Controls
If (ctrl.Tag = "cmdButton") Then
' Create Mouse Events
ctrl.OnMouseUp = "=cmdButton_MoveUp(" & Chr(34) & ctrl.Name & Chr(34) & ",Form.Name)"
ctrl.OnMouseDown = "=cmdButton_MoveDown(" & Chr(34) & ctrl.Name & Chr(34) & ",Form.Name)"
ctrl.OnMouseMove = "=cmdButton_Hover(" & Chr(34) & ctrl.Name & Chr(34) & ",Form.Name)"
' Set image visibilities
Form.Controls(ctrl.Name & "_Up").Visible = True
Form.Controls(ctrl.Name & "_Down").Visible = False
Form.Controls(ctrl.Name & "_Hover").Visible = False
End If
Next

Form.Detail.OnMouseMove = vbNullString
End Sub


Can anyone clue me in to how to make this work for multiple image stack buttons?

PS: I know this is much easier in 2010 but this Application has to be 2003.
Thanks.
 

Attachments

Users who are viewing this thread

Back
Top Bottom