Using a controls property directly for TRUE or FALSE

Access Database Developer Tips from Xlteq

Imaging you are writing some code which detects if a text box is visible or not on the form. If it is visible, then you want to make it not visible. Likewise, if it is not visible then you want to make it visible.

You might write some code like this:

However, you can make the code simpler because the Visible property of the button only returns TRUE or FALSE, which you can use directly as follows:

We can even go further because what we actually want to do is set the visible property to the opposite of what it currently is. Using the “NOT” command can do this for use (ie it turns TRUE into FALSE and vice versa).

Contact us for a free consultation

Either call us now on 020 3817 6945 or fill out the form below and one of our team will be in touch.

The contact form requires that you configure reCAPTCHA in the site configuration.

The contact form requires that you select an email template.