Blog Post
Microsoft Access Forms – Using Macro Filters & Buttons to Manipulate a Subform


Using Macro Filters to Manipulate Subform Data
This blog was inspired by a Delegate of mine, who needed a way of filtering his form data when his database was saved as an .accde database. Now this wouldn’t usually be a problem, however he wasn’t using Microsoft Access to open the .accede database, so he didn’t have filtering options on a ribbon.
[What is a Subform?](#What is a Subform?)[Creating a SubForm](#Creating a SubForm)[Creating a Macro Filter](#Creating a Macro Filter)
What is a Subform?
A Subform, is a Child Form that can be linked to a Parent Form, via related data.
e.g. The example below shows a Parent Form containing Sales Person Data, and a Child Subform below containing related Order Data. (It only shows orders taken by the salesperson named on the form) Also, on the Parent Form you can see Buttons, these buttons have the macro filters attached.
Creating a SubForm
Creating a Macro Filter
In the previous Access Blog I showed you how to create a macro, and attach it to a button. If you missed it, click here now.
The Macro you will need to be able to filter your SubForm data is SetFilter.
You will be presented the the following:
You need to provide the Macro with a Name, a Filter (Where condition) and provide the name of the child Subform you want it to control. I have filled it in based on my Sales Person and Orders data, the filter will allow me to view my data between a start and end date.
Where Condition: [Order Date] represents the Order Date Field, [StartDate] and [EndDate] represent Parameters which will ask the user which dates they want to view between.
The User will be provided with the following.
Share This Post
Ian Roberts
Technical Director
Ian is an incredibly talented solutions architect. He has over 15 years of experience working with data, as part of a broader IT career spanning over 20 years.
Frequently Asked Questions
Couldn’t find the answer you were looking for? Feel free to reach out to us! Our team of experts is here to help.
Contact Us