Combo Box Selection Filters Results in Subform

Local time
Today, 12:20
Joined
Jun 3, 2022
Messages
38
Can a filter occur for combo box selection into subform
 
Last edited:
Hi. Yes, that should be possible. Is this requirement in addition to using the Linked Master and Child Fields?
 
Master and Child Fields have been removed from the forms so there's no linking. (I was given this database to fix up)
Why were they removed? Just curious...
 
Why were they removed? Just curious...
As I spoke to my work colleague this morning, she stated that when the Master and Child Fields were linked the data was not displaying down below in the subform so she removed the "linking" and once the MainForm was filled out at the top, the subform down below populated the data.
 
create first a Query for your table that you use in your Subform, eg:

(qrySubData)
select * from yourSubFormTableName where BrNumber = IIF(IsNull([Forms]![frmEstimateBt]![cboBrNumber]), [BrNumber], [Forms]![frmEstimateBt]![cboBrNumber])

In design view of your form, use the Query (qrySubData) as the RowSource of your Subform.
add code to the AfterUpdate Event of cboBrNumber combobox:

Private Sub cboBrNumber_AfterUpdate()
Me!subfrmEstimateBr.Requery
End Sub
 
Last edited:
see this demo.
this is using the technique in post#7.
the data may not be the same with what you have
but the idea is the same.
 

Attachments

The master should be the combo?
 
Leave the Master/child links because you need them to restrict the search to only the children of the parent record.

Then change the RecordSource query of the subform to include a Where clause that references the UNBOUND combo on the main form.

Select ...
From ...
Where SomeField = Forms!MyMainForm!cboFilter OR Forms!MyMainForm!cboSearch Is Null

In the Click event of the combo, requery the subform:
Me.SubformControlName.Form.Requery

I think that Filters do not work on subforms.
 
Was able to figure this out by Linking the Master and Child Fields together, it worked! Thanks for the help on this.
 
Was able to figure this out by Linking the Master and Child Fields together, it worked! Thanks for the help on this.
Hi. Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom