Click Image and call label Click event

  • Thread starter jlg via AccessMonster.com
  • Start date
J

jlg via AccessMonster.com

I have a menu form with labels and images. I have highlight and unHighlight
code functioning fine (switching images, fonts, etc). All of my labels have
_click() events that are currently the standard Private Sub cmdName_click()
events that all work correctly. I created a function Function ImageClick
(cmdName as string). For each Image, the Click event calls the function
=ImageClick("cmdName"). So, when you click the image, it sends the related
cmdName and should run its click event. I cannot get it to work. Here is an
example of one image and label scenario.

Label name = cmdExit

Sub cmdExit_click()
...do things before closing
Application.Quit
End Sub

----------------

Image name = imgExit

imgExit onclick Event: =ImageClick("cmdExit")

----------------

Function ImageClick(ControlName As String)
Dim menuSub As String

menuSub = ControlName & "_Click"
Debug.Print menuSub
'follow Click event of related menu item
Run (menuSub)

End Function
----------------

The debug results in 'cmdExit_Click' which is correct. If I type in
cmdExit_Click it works.
I have tried EVAL, I have tried CALL and I have tried RUN. What am i missing?
I know this can be done. Thanks for ANY suggestions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top