473,503 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access combo-box

6 New Member
Returning to Access after years of break!

Have combo box on form populated with 3 records:

Height
Weight
Width

I wish to make height fields visible on the form if I select height, but others remain invisible.

When I select weight, then the height fields become invisible and the weight fields become visible.

Help here is greatly appreciated.
Feb 12 '07 #1
5 1698
MMcCarthy
14,534 Recognized Expert Moderator MVP
In the AfterUpdate event of the combobox put the following code (adapted to your control names)

Expand|Select|Wrap|Line Numbers
  1. Private Sub comboBoxName_AfterUpdate()
  2.  
  3.   SELECT CASE ComboBoxName.Value
  4.     CASE "Height"
  5.       Me.txtHeight.Visible = True
  6.       Me.txtWeight.Visible = False
  7.       Me.txtWidth.Visible = False
  8.     CASE "Weight"
  9.       Me.txtHeight.Visible = False
  10.       Me.txtWeight.Visible = True
  11.       Me.txtWidth.Visible = False
  12.     CASE "Width"
  13.       Me.txtHeight.Visible = False
  14.       Me.txtWeight.Visible = False
  15.       Me.txtWidth.Visible = True
  16.   End SELECT
  17.  
  18. End Sub
  19.  
Mary
Feb 12 '07 #2
NeoPa
32,557 Recognized Expert Moderator MVP
This code should work too.
It's a bit more expandable (Easier to add extra levels of selection).
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboBox_AfterUpdate()
  2.     Me!txtHeight.Visible = (Me!cboBox = "Height")
  3.     Me!txtWeight.Visible = (Me!cboBox = "Weight")
  4.     Me!txtWidth.Visible = (Me!cboBox = "Width")
  5. End Sub
Feb 12 '07 #3
philiprodley
6 New Member
Thank you, Mary and NeoPa--

That's just fine
Feb 13 '07 #4
NeoPa
32,557 Recognized Expert Moderator MVP
Pleased to hear it's working for you :)
Feb 13 '07 #5
MMcCarthy
14,534 Recognized Expert Moderator MVP
Pleased to hear it's working for you :)
You're welcome.
Feb 13 '07 #6

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

Similar topics

3
1517
by: Jim J | last post by:
I have been trying to find some kind of authentication method or script (PHP/perl/javascript or other) to achieve the following, with no luck. Say there are 100 files at a site. A person can...
3
1298
by: Wayne Aprato | last post by:
Can anyone shed any light on the following problem which has shown itself in a couple of my Access 97 databases. When I ask Access to open a form that is based on a query, it will randomly fall...
3
6081
by: krygsma | last post by:
So, I need to figure out how to do what I want to do with Access. I have many questions with mutually exclusive options, each option has a value, never=0, few times=1...ect.. (then when questions...
1
1154
by: sonu | last post by:
I am working with a window application which will run on every computer on a network. but data will be only one machine on network. i am giving in connection string like.. connectionString =...
6
1542
by: Matthew Wells | last post by:
Can you bind ado recordsets to combo boxes and list boxes in Access 2000? thanks Matthew Wells MWells@FirstByte.net
2
1207
by: sergiosr | last post by:
These are my tables: Client ------ ClientID Provider --------- ProviderID
9
2641
by: anthony | last post by:
In Access 2007, why does a query field designed as Term: ! ! return 00:00:00 when cboTerm actually contains 08SP. This works as expected in Access 2003?
1
6193
by: G04 | last post by:
Hi All, I have a continuous form with all records. For each field there is a combo in the form header and the form also contains a Toggle button "Apply Filter". When clicked, it changes to...
1
1337
by: Brian McLaughlin | last post by:
Hi. Probably a simple problem but i'm pulling my hair out! I have 3 tables(Consultant name, hospital and medical department). Consultant name is joined to the other two by their primary key. I...
1
1601
by: bbcdancer | last post by:
1. MS ACCESS COMBO LIST = JAN;FEB;MAR;APR;MAY; ----------------------------------- 2. DATA TABLE: N1 | N2 | N3 | JAN | FEB | MAR | APR | MAY | -------------------------------------------- a1 |...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7348
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7006
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5021
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4685
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3166
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1519
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
397
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.