I can't get ComboBox to filter query

Decca_22_16 1 Reputation point
2021-07-09T13:27:47.793+00:00

Firstly I am a new Access user - so please bear in mind when replying.

I have built a simple database which has 7 columns (including ID). I want to be able to search on these individually so I have set up a query for each one.

However, other than 1 column, I would like to be able to choose from a drop down menu to be able to select from a defined list and then search on that.

As such, I have followed instruction online and have created a blank form and on there created a ComboBox, which I have linked to the table to get inputs. Side problem, I can't get it to stop showing duplicates even when I click the 'unique inputs' tick box. In case it's relevant.

I then on the table have used [Forms]![Search]![Combo17] in Criteria under the relevant column to link it to Combobox.

On the Form I have then added a Command Button, which I have linked to Run Query. However the return query is always blank when it returns.
113421-image.png

I have re-done all the links to make sure that I am referencing the correct locations. Plus checked the query work when using a text entry e.g [Enter Country] in the Criteria field. When you type it in it shows correctly.

What is going wrong that it doesn't link with the ComboBox?

Microsoft 365 and Office | Access | Development
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. DBG 2,456 Reputation points Volunteer Moderator
    2021-07-09T14:19:03.607+00:00

    Hi. Can you show us the SQL statement of the query you're trying to run from your button?


  2. Ken Sheridan 2,851 Reputation points
    2021-07-11T16:12:20.477+00:00

    Also, what are the RowSource, BoundColumn, ColumnWidths, and ColumnCount properties of the combo box? If the RowSource property is the name of a query, what is the query's SQL statement?


  3. Ken Sheridan 2,851 Reputation points
    2021-07-12T10:10:46.13+00:00

    The combo box's BoundColumn, and hence is value, is the hidden ID column, not the Country column. Consequently referencing it as a parameter will not give a match. You need to change the RowSource property to:

    SELECT DISTINCT Country
    FROM [Vendor Information]
    ORDER BY Country;

    The ColumnCount property should also be changed to 1, and the ColumnWidths property's value deleted.


  4. DBG 2,456 Reputation points Volunteer Moderator
    2021-07-14T17:23:55.45+00:00

    Looks like there are commas before FROM and before ORDER. Try taking them out.

    0 comments No comments

  5. Decca_22_16 1 Reputation point
    2021-07-15T08:50:55.153+00:00

    Seemed to of fixed it by added the required field using the method in this tutorial

    https://www.techonthenet.com/access/tutorials/combobasics2010/basics08.php

    It now returns search results


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.