Hi guys,
I have written a function to link CmdButton images on my forms.
This enables the .mde to be installed anywhere and as long as the images folder in installed into the same directory, the images will show.
The function (not exact as its on my other PC is as below):
Syntax may not be exactly correct as its from memory but it basically cycles through each command button and loads the relevant image.
My problem is that this will only run on one form at a time i.e. Forms(current).
As my main menu is open all the time it means when i call this function in the open of event of any other forms, it does not work.
What do I need to set "MyForm" to, to allow the function to work on any form that opens.
Also how can I get this to work on subforms? Do I need to cycle through each form first?
Thanks
Ben
I have written a function to link CmdButton images on my forms.
This enables the .mde to be installed anywhere and as long as the images folder in installed into the same directory, the images will show.
The function (not exact as its on my other PC is as below):
Code:
Public Function GetCmdButtonImages()
Dim ctl as Control
Dim ImagePath as String
Set MyForm = Forms(Current)
For Each ctl in MyForm.Controls
Select Case ctl.ControlType
Case acCmdButton
ImagePath = Application.CurrentProject.Path & "\images\" & ctl.name & ".bmp"
ctl.Picture = ImagePath
End Select
Next ctl
End Function
Syntax may not be exactly correct as its from memory but it basically cycles through each command button and loads the relevant image.
My problem is that this will only run on one form at a time i.e. Forms(current).
As my main menu is open all the time it means when i call this function in the open of event of any other forms, it does not work.
What do I need to set "MyForm" to, to allow the function to work on any form that opens.
Also how can I get this to work on subforms? Do I need to cycle through each form first?
Thanks
Ben