set visible property of icon

siamandm
BronzeLounger
Posts: 1234
Joined: 01 May 2016, 09:58

set visible property of icon

Post by siamandm »

Hi All

i have a textbox called txtSearch and icon called ClearSearch ,
the visible property of the ClearSearch icon is set to NO, so when the form load, the ClearSearch is not visible,

i added this event to changeEvent of the txtSearch, which make the ClearSearch appears when I put some character in the txtSearch

Code: Select all

Private Sub txtSearch_Change()
       
            DoCmd.SetProperty "iconSearchClear", acPropertyVisible, "1"
            
End Sub
this works fine, but i want to make the ClearSearch icon to disappear again when i delete everything inside the txtSearch text box.

i tried to use if statement but didn't work for me : if txtSearch = "" then DoCmd.SetProperty "iconSearchClear", acPropertyVisible, "0"


regards

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: set visible property of icon

Post by HansV »

In the On Change event of a text box, you have to use its Text property. Use

If txtSearch.Text = "" Then ...
Best wishes,
Hans

siamandm
BronzeLounger
Posts: 1234
Joined: 01 May 2016, 09:58

Re: set visible property of icon

Post by siamandm »

thanks alot, woking as expected.

Regards