SetProperty visible problems

MarlonVisser0408

New member
Local time
Today, 09:09
Joined
Mar 4, 2025
Messages
24
I'm trying to create a situation where if I press the orange "Add" button, the subform to the right turns to visible ="No". When I press it again, I want to be able to put it to visible = "Yes". My problem is that whenever I've changed it to not visible, the same logic doesn't work backwards.
1747754619080.png
 
me.somecontrol.visible = not me.somecontrol.visible
 
As a followup question, just to the basics of it. Why would this only work 1 way around? Why wouldn't clicking the button for the second time make it reappear?
 

Attachments

  • 1747755081239.png
    1747755081239.png
    6.8 KB · Views: 11
Use True and False instead of Yes and No.

True is an intrinsic constant with value of -1 (False is 0).

The reason it sets only to not visible is because ANYTHING that is not True (-1) is treated as False and that includes "Yes".

I know, the property in design shows Yes or No but code expects True or False.
 
Last edited:
Consider using a Toggle button instead.

In either case, consider code to change button Caption property as well.
 

Users who are viewing this thread

Back
Top Bottom