MS Access ToggleButton图片更改 [英] MS Access ToggleButton Picture change
问题描述
我想知道是否可以根据切换按钮的状态(按下和未按下)更改Access VBA中切换按钮的图片?
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)?
我之前的尝试包括检查按钮的值是否为"true",但实际上并没有产生有效的结果.
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.
推荐答案
看起来该代码似乎正常运行,只是将其放置在错误的代码部分中.整个if-else语句放置在Form_Load()
子目录中,而不是在Toggle4_OnClick()
中.特别感谢June7的帮助.
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.
这篇关于MS Access ToggleButton图片更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!