Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
321 views
in Technique[技术] by (71.8m points)

vba - MS Access ToggleButton Picture change

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...