MS Access ToggleButton Picture change

2019-08-17 04:37发布

问题:

I was wondering if it is possible to change the picture of a toggle button in Access VBA depending on the state of the toggle button (pressed and not pressed)?

My previous attempt on doing it included a check if the button's value is "true", but it hasn't really produced a valid result.

If Me.Toggle4.Value = True Then
    Me.Toggle4.Picture = "IMAGE"
Else
    Me.Toggle4.Picture = "IMAGE"
End If

What the code above produces is the button always having the same image.

回答1:

It appears that the code seemed to run properly, except that it was place in the incorrect code section. The whole if-else statement was placed in the Form_Load() sub rather than the Toggle4_OnClick(). Special thanks to June7 for the help.