Link to home
Start Free TrialLog in
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.
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

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.
Avatar of Dale James
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
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Jim and Gustav for your assistance.

Just working through the detail at the moment.  

Will feedback soon.

Ta

Dale
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You are welcome!