MS Access ToggleButton Picture change

五迷三道 提交于 2020-01-06 06:46:16

问题


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.



来源:https://stackoverflow.com/questions/47914489/ms-access-togglebutton-picture-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!