470,862 Members | 1,625 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,862 developers. It's quick & easy.

Show / Hide Fields

Is it at all possible to show or hide fields based on a selection from a drop down box. I am new to access but have built a database, I have around 7 different options to choose from. But only one should trigger the other fields to appear.

Thanks 🙏 again for your help...
May 16 '21 #1
2 2752
32,311 Expert Mod 16PB
Not only possible, but a common requirement :-) Welcome to Bytes.com.

In the _AfterUpdate() event procedure you would have code that sets the visibility of other Controls (Not Fields exactly - Fields do little more than hold data whereas Controls are a little more complicated.) based on the value found in your other Control.

At a very basic level, if you have a Form (frmX), a ComboBox Control (cboY) and just one TextBox Control (txtZ) to be shown (if cboY = "A") or hidden (if cboY = {anything else}) then you would want code based on this simple template :
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboY_AfterUpdate()
  2.     Dim blnVisible As Boolean
  4.     With Me
  5.         blnVisible = .cboY = "A"
  6.         .txtZ.Visible = blnVisible
  7.     End With
  8. End Sub
May 16 '21 #2
358 Expert Mod 256MB
For info, if this is being done in a table, query or datasheet form, you can just right click and Select Hide Fields
May 17 '21 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by oLE | last post: by
3 posts views Thread by alex | last post: by
4 posts views Thread by bridgemanusa | last post: by
7 posts views Thread by FP | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.