Search code examples
ms-accesssubform

Access 2010 Populate Subform with Query


I think this is an overly easy question but my brain is failing to work so I need some help.

I have a form that in a nutshell has the user enter a start date and end date into 2 date/time text boxes. I have a query that filters out the records that fall between the specified dates.

What I want to do is have a subform populate/refresh anytime an After Update of either of these text fields are adjusted so long as both have values, (i.e. if one is blank there will be no changes).

Im sure this is straight forward so any tips is much appreciated!


Solution

  • It depends on how you have set up the subform. You can use the after update events of the textboxes to set the recordsource of the subform or to requery.

     Me.MySubformcontrolName.Form.Recordsource ="Select ..."
     Me.MySubformcontrolName.Form.Requery