If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Unique values in a combo box
I have a form that displays my records stored in a table "inspectionsDI" I
have a listbox in the form that displays all the records for easy to find access. I will have over 400 records so I want to make a combo box that will filter my listbox according to a value stored in the table. I can make it so that the combo box displays all the values but there are many duplicates, how do I make the combo box show only each unique value once? Or is there are better way to approach this problem? |
#2
|
|||
|
|||
Unique values in a combo box
dannie,
Design a query to use as the record source for your combo box. One of the properties that you can set for the query is "unique values". Set this property to true for your query. ----- HTH Mr. B http://www.askdoctoraccess.com/ Doctor Access Downloads Page: http://www.askdoctoraccess.com/DownloadPage.htm "dannie" wrote: I have a form that displays my records stored in a table "inspectionsDI" I have a listbox in the form that displays all the records for easy to find access. I will have over 400 records so I want to make a combo box that will filter my listbox according to a value stored in the table. I can make it so that the combo box displays all the values but there are many duplicates, how do I make the combo box show only each unique value once? Or is there are better way to approach this problem? |
#3
|
|||
|
|||
Unique values in a combo box
Having a listbox with "over 400" records is more than most users will put up
with. g Adding a combobox to narrow the list down is a way to reduce the number of rows the users have to work through ... BUT! If you have a combobox to help select the right record, why bother with the listbox at all? Your combobox would take up less room on the form and would still give your users a way to select the right record. JOPO (just one person's opinion) Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or psuedocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "dannie" wrote in message ... I have a form that displays my records stored in a table "inspectionsDI" I have a listbox in the form that displays all the records for easy to find access. I will have over 400 records so I want to make a combo box that will filter my listbox according to a value stored in the table. I can make it so that the combo box displays all the values but there are many duplicates, how do I make the combo box show only each unique value once? Or is there are better way to approach this problem? |
#4
|
|||
|
|||
Unique values in a combo box
On Mon, 19 Oct 2009 09:08:11 -0700, dannie wrote:
I have a form that displays my records stored in a table "inspectionsDI" I have a listbox in the form that displays all the records for easy to find access. I will have over 400 records so I want to make a combo box that will filter my listbox according to a value stored in the table. I can make it so that the combo box displays all the values but there are many duplicates, how do I make the combo box show only each unique value once? Or is there are better way to approach this problem? I'm not sure I follow what you want, but I think ..... Create a query to display just the distinct records. Select Distinct MyTable.[FieldName] from MyTable; use that as the Combo Rowsource. (Look up the Distinct keyword in SQL help.) Then, to filter the List Box, code the Combo Box AfterUpdate event (all on one line): Me.ListBoxName.Rowsource = "Select inpsectionDI.FieldName1, inspectionDI.FieldName2 from inspectionDI Where inspectionDI.FieldName = """ & Me.ComboName & """;" The coding above assumes the value in MyTable.FieldName is Text datatype. If in fact it is Number datatype then use: Me.ListBoxName.Rowsource = "Select .... etc ..... Where inspectionDI.FieldName = "& Me.ComboName Change all of the control, field, and table names to whatever your actual names are. -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
Thread Tools | |
Display Modes | |
|
|