guest writer is Kerry Westphal-our resident macro expert. feature in well-designed applications is giving users the ability to quickly focus on the data they care about. A search or filter form allows users to specify criteria to limit the records returned. This also enhances performance because the entire recordset is not brought in. filter form provides unbound text boxes, combo boxes, and other controls where users can build and refine requirements for records to meet in order to be displayed on the form. Allen Browne has a great VBA example here where he uses a filter form to search for clients by name, type, city, level and / or start and end dates. In Allen's example, the form Filter property is set to a string that is built based on user criteria,
Microsoft Office Enterprise 2007 Activation Key, and the FilterOn action is invoked. the same goals using macros that run on the Web, let's walk through an example together. This demonstrates using the BrowseTo action to swap out the subform, TempVars are used to store form criteria and If statements decide which criteria is relevant. issues that arise at work, I have a database where I filter issues by words in the summary, person it is assigned to, and the state of their resolution. When I first browse to the form, instead of showing data, the subform is populated with a form which displays a message that says the subform with only showing only data that meets the specified criteria. the example above, I have specified criteria to limit issues displayed to those with will run and the filtered records will show. we consider all the criteria,
Microsoft Office 2007 Ultimate Key, let's construct a simple macro that considers only the Summary criteria textbox (txtSummary). Once our macro is working, we will add in more logic. thing we will do in the macro is set up the error handler using the OnError action to specify a Submacro named ErrorHandler to be called in case there is an error message to display. Next we will use SetTempVar to assign the value contained by the txtSummary control to a TempVar. If the txtSummary control contains a value,
Office 2010 Serial, the Like operator is used with wildcards in the Where Condition argument of the BrowseTo action to show the proper records. Otherwise, the BrowseTo action will show all the records. More information about the BrowseTo action can be found here grab the XML here (Note: to copy this XML to paste into the macro designer, use Page-> View Source and copy the XML from there). that our basic macro is tested (I did that for us and it works J),
Office 2010 Pro Plus 32 Bit, we will add another condition to see only the issues assigned to the person selected in the dropdown. We can use the same logic to filter on the Assigned To field that we used for filtering on the Summary field. our assignments section at the top of the macro, we will add another SetTempVar action to store the AssignedTo criteria on the form. If the AssignedTo criteria is not filled out, the logic we built above to consider Summary criteria for BrowseTo will be executed. If AssignedTo critieria is filled out but the Summary criteria is not,
Windows 7 Pro 64bit, only AssignedTo will be considered in the BrowseTo Where Condition. If both AssignedTo and Summary criteria are specified, the Where Condition of BrowseTo concatenates them both. XML here. can do a similar check for Resolution criteria. This can continue for as many fields as we want to validate in our filter form to show as many or few records as needed. The macro is below and you can grab the XML for the entire macro here. macros have you been making? <div