Automatic updating of query shown in a form based on dropdown selection
NickName:rohrl77 Ask DateTime:2015-06-17T20:28:36

Automatic updating of query shown in a form based on dropdown selection

I thought this was going to be the easiest question ever to solve, but after spending a morning searching for answers, I still can't get it to work.

I have a list box showing data for certain countries on a user form that is linked to a query. I want to allow my users to filer that list based on the selection in a dropdown.

This is the SQL in the list box row source:

SELECT tblFUNDS.MorningsStar_Fund_Name, tblFUNDS.ISIN, tblFUNDS.RDR, tblISIN_Country_Table.Country
FROM tblFUNDS INNER JOIN tblISIN_Country_Table ON tblFUNDS.ISIN = tblISIN_Country_Table.ISIN
GROUP BY tblFUNDS.MorningsStar_Fund_Name, tblFUNDS.ISIN, tblFUNDS.RDR, tblISIN_Country_Table.Country, tblFUNDS.Fund_Selection
HAVING (((tblISIN_Country_Table.Country)=[Forms]![frmMain]![ddnCountry]) AND ((tblFUNDS.Fund_Selection)=0));

Both the values in the list box and the dropdown are displaying correctly. However, I have not been able to get the dropdown selection to filter the list.

So far I have tried inserting the following reference and various versions of it into the query that the list box links to in the row source:

[Forms]![frmMain]![ddnCountry]

I also inserted the following code for the On Change Event in the Dropdownlist:

Private Sub ddnCountry_Change()
    cmbFIlterSelection.Requery
End Sub

The On Change event fires correctly because when I set a breakpoint it stops on the one line of code, but it seems to do nothing.

What am I doing wrong?

Copyright Notice:Content Author:「rohrl77」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30891629/automatic-updating-of-query-shown-in-a-form-based-on-dropdown-selection

More about “Automatic updating of query shown in a form based on dropdown selection” related questions

Automatic updating of query shown in a form based on dropdown selection

I thought this was going to be the easiest question ever to solve, but after spending a morning searching for answers, I still can't get it to work. I have a list box showing data for certain coun...

Show Detail

How to show all items in Listbox that is linked to dropdown

In an Access Userform I have a listbox that is linked to a dropdown field. In the dropdown field the user can choose a country, and the listbox then updates and shows only the records that are rele...

Show Detail

Joomla database query based on dropdown selection

I am very new to programing but after a lot of research i can rufly manage to create a dropdown selection from database and show a column result from that table based on the dropdown selection us...

Show Detail

React loadStripe method not updating the element form on country wise selection

I have different stripe accounts for different countries, So on dropdown selection I want to change stripe checkout/element form according to country wise selection as shown in picture 1 // public_...

Show Detail

How can I prefill my form based on a dropdown menu selection value?

I have a form that has a dropdown selection menu that loads invoice ids from my database. I'm trying to prefill my form based on the value of the invoice selected from the drop down menu. In my

Show Detail

How to populate dropdown list based on selection of another dropdown (Wordpress Form Maker)

I'm trying to populate a second dropdown list based on selection from a first dropdown list using WordPress plugin Form Maker by WebDorado. I have two tables on MySQL db "Company" and "Branches" wh...

Show Detail

Updating a sub-form based on a list box selection - Access 2013

Afternoon all. A bit of context: Our office recently moved from Access 2010 to 2013, originally I had assumed all was well and everything worked as it did in 2010. However recent revelations have

Show Detail

SQL Query based on dropdown menu selection

I create a dropdown like this: <header> <h3 align="center"> Highway State </h3> </header> <section> <article> &l

Show Detail

How to change text box values based on dropdown selection from database

I have successfully been able to retrieve values from a MySQL database into a dropdown list using the code below: <select name= "patientname" id="pname" class="form-control2" required> ...

Show Detail

php saving user selection from a dropdown menu and running a query

I have a php script that connects to my database and has two drop down menus. Now what I want to do is, based on what the user selection is, run queries on the user selection. The options in the drop

Show Detail