We help IT Professionals succeed at work.

MS ACCESS:  Hide Specific Values from Combo box

102 Views
Last Modified: 2019-02-19
Hello Team

Can you please advise how to hide specific values from a combobox list?

For example:  I have a main form which is used to either display previously created records or can be used to create new records.  When the form is loaded to display a history record, the combobox cboErrorCat displays, Error1, Error2, Error3, Error4 when selected. What I require is for the cboErrorCat to display only Error1 and Error2 when the form is loaded to create a new record.

Main Form is called frmPaymentError, combobox is named, cboErrorCat and the row source for the cboErrorCat combobox is called qryErrorCategories

Query SQL
SELECT tblErrorCategories.ErrorCategoryID AS Expr1, tblErrorCategories.ErrorCategory AS Expr2
FROM tblErrorCategories
WHERE (((tblErrorCategories.DateExpired)>Date()))
ORDER BY tblErrorCategories.Order;

Open in new window



Any assistance would be much appreciated.

Thanks in advance.
Comment
Watch Question

Jim Dettman (EE MVE)President / Owner
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017

Commented:
There are two basic ways to achieve this:

1. Load the combo with the values you want, either with a call back function or constructing a value list.

2. Adding criteria to the query it's based on or switching the row source to a different query, and then requerying.

 Typically one does #2, but you didn't say what conditions make the various entries possible, so #2 might not be doable.

 Explain a little more how the values are chosen under what conditions.

Jim.
Dale JamesTherapist

Author

Commented:
Hello Jim

Thanks for getting back to me.

The values for the combo list are obtained from a rowsource value list via the query qryErrorCategories.  This query consists of all the values that are seen when viewing historical records but when creating a new record only Error1 and Error2 list values (items) are to be viewable.

There is currently no filtering or criteria set in the query to limit the view of values.

Please let me know if you need more detail as am not sure if the above is addressing your question.

Ta

Dale
President / Owner
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Dale JamesTherapist

Author

Commented:
Thanks Jim and Gustav for your assistance.

Just working through the detail at the moment.  

Will feedback soon.

Ta

Dale
Dale JamesTherapist
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
You are welcome!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.