I've got a series of toggle buttons that are bound to yes/no fields in a table. Right now, the picture for all of them in the properties section is set to BtnGray.bmp (which is embedded). I have another .bmp file (BtnBlue.bmp) that I want to display if the toggle button's state is true.
My previous attempt to work around this problem (although I'm pretty sure this is NOT the way it should be done) involved creating an unbound toggle button, setting it's visibility to "No" and calling for that picture on the AfterUpdate event of the bound toggle button.
In the code, IntSypmtPain is the bound toggle button, and ToggleBlue is the unbound button that contains the picture I want to use.
I'm having 2 problems with my shoddy workaround:
1. I'm getting an error:
"Run-time error '2220': Microsoft Access can't open the file 'BtnBlue.bmp'."
When I click debug, the line containing "Me.IntSymptPai n.Picture = Me.ToggleBlue.P icture" is highlighted.
2. This only runs on the AfterUpdate event, so when I open a form to this specific record, it doesn't try to get BtnBlue.bmp until after the button has been clicked. I know I could add the code to multiple events within the form, but seeing as I have multiple toggle buttons, wouldn't that get a little ridiculous?
My previous attempt to work around this problem (although I'm pretty sure this is NOT the way it should be done) involved creating an unbound toggle button, setting it's visibility to "No" and calling for that picture on the AfterUpdate event of the bound toggle button.
In the code, IntSypmtPain is the bound toggle button, and ToggleBlue is the unbound button that contains the picture I want to use.
Code:
Private Sub IntSymptPain_AfterUpdate()
If IntSymptPain.Value = True Then
Me.IntSymptPain.Picture = Me.ToggleBlue.Picture
End If
End Sub
I'm having 2 problems with my shoddy workaround:
1. I'm getting an error:
"Run-time error '2220': Microsoft Access can't open the file 'BtnBlue.bmp'."
When I click debug, the line containing "Me.IntSymptPai n.Picture = Me.ToggleBlue.P icture" is highlighted.
2. This only runs on the AfterUpdate event, so when I open a form to this specific record, it doesn't try to get BtnBlue.bmp until after the button has been clicked. I know I could add the code to multiple events within the form, but seeing as I have multiple toggle buttons, wouldn't that get a little ridiculous?
Comment