Hiding Fields

cpu22

New member
Local time
Today, 13:49
Joined
Jan 5, 2018
Messages
9
Hello Everyone,

I haven't used Access for some time, maybe 15 years. I do have some familiarity with advanced VBA concepts though.

What I'm looking to do is the following: I will be pulling up a form with the underlying table having many fields, most of which will be null. If the field is null, or a certain value I specify, I would like it to not be visible. I want this to happen right on load. Should be pretty simple, but like I said, I haven't used Access in a long time. Any help would be appreciated.

Thanks in advance,
Christian
 
You would want to use the On_Current event for the form.
The following links will help you with what events do what.

https://msdn.microsoft.com/en-us/library/office/jj249049.aspx
https://support.office.com/en-us/ar...-objects-e76fbbfe-6180-4a52-8787-ce86553682f9

In the On_Current, you would want to check the value of each control and set the its .visible to true/false as needed, something like:
Code:
IF IsNull(Me.Txt_FieldName) Then
   Me.Txt_FieldName.Visible = False
Else
   Me.Txt_FieldName.Visible = True
End If

For properties you can set check the following:
https://msdn.microsoft.com/en-us/vba/access-vba/articles/textbox-object-access

Hope this helps!
 
Thank you so much! I bet that one was rather simple for you. And thanks for the links! Very helpful. Works like a charm.

Have a great weekend.
 

Users who are viewing this thread

Back
Top Bottom