Avatar of Dale James
Dale James
 asked on

MS ACCESS: Hide Specific Values from Combo box

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.
Microsoft AccessVBASQL

Avatar of undefined
Last Comment
Gustav Brock

8/22/2022 - Mon
Jim Dettman (EE MVE)

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 James

ASKER
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
ASKER CERTIFIED SOLUTION
Jim Dettman (EE MVE)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Dale James

ASKER
Thanks Jim and Gustav for your assistance.

Just working through the detail at the moment.  

Will feedback soon.

Ta

Dale
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Gustav Brock

You are welcome!