Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combo box hidden values

Status
Not open for further replies.

striker73

MIS
Jun 7, 2001
376
US
I have a combo box that contains a few values, except I only show one value, the rest are hidden. Hiding this information works fine except when the field is left blank. The combo box gets its fields from a query. Is there any way that I can say if it is null in the query, then don't worry about it? Any ideas? Thanks!!
 
If you have more than one table in the query for your combo you may need to specify a different join type. In the query designer right click on the join, select Join Properties, and select one of the join types that says "Select all from...", make it the one that selects all from the table that always has data.

I don't know if this is your problem, but it might be
 
If you are using a query to provide the source, any blank line in the source will show as a blank in the listbox. To avoid this, use VBA code. Take your original query and use DAO(if you are using JET) (or ADO if otherwise) to get a result set of the items you want. Using code, cycle through the result set and append each item to list source for the list box. Have your code ignore any Null value it encounters. The result will be a list box with no blank lines. "Databases That Work The Way You Do!"
 
Esentially what you want to do is not show the records which are null, even if the other,hidden fields have values.

In the Design View of your form
edit the properties of the Combo box
Under the Data tag edit the Row Source by clicking on the "..." icon to the right.

This should show you a view of the Query you are using for the values in your combo box.

In the Criteria of the field you are using as your visible value try <>&quot;&quot; or Is Not Null. You may need both.

Close the Query View. You will get an Exclamation asking if you want to save the changes to the SQL Statement. Select Yes.

Save your Form and test the combobox in the Form View.


I hope it works.
Rémy Still new to DB's and enjoying learning day by day
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top