VBA: Access ComboBox / SubForm/ Input Query
Posted on 2010-11-26
I need help in making a combo box as the input parameter for a query in a sub form. Please excuse my wording as I'm still trying to learn access.
I created a combo box in a form that shows all the "Bank_LegalName" from tblBanks. It's a simple select query.
I created another query named qryBankName_Input with the following sql:
As you can tell now, my form name is frmBankName. In this form, under the combo box with the 1st query above, I created a subform/subreport with the control wizard on using the 2nd query, qryBankName_Input, as the recordsource
I then built an event vba code (which I think I used the wrong command)
Private Sub Combo0_Change()
The problem is when I change the combo box, a new window pops up showing me the query results (not what I had in mind). If I change the bankname from the combobox, close the form, reopen it, the results would be sitting in there as intended.
Can anyone assist in helping me understand how can I have the query that's embedded as a subform in the main form to be "bound?" to the combo box? I want on each change of the combo box, show the result BankContacts in the subform on the fly.