In this example, my client wanted to be able to filter the Contract Maintenance - Lines window by Item Number and/or Serial Number. Their contracts can be quite lengthy. Research and contract maintenance would be cumbersome and inefficient without the ability to filter the records in this window.
To do this, use Modifier to add 2 new Text Boxes to the Contract Maintenance - Lines window in which to capture the filter criteria. I placed them directly above the grid in the window.
Next, add the Contract Maintenance - Lines window and the following fields to your VBA Project:
- Item Number and Serial Number in the Grid
- Item Number and Serial Number fields you added with Modifier
Paste the following code in the ContractMaintenanceLDetail Grid BeforeLinePopulate event:
Now, just click the Redisplay button to apply the filter.
This code will evaluate records as they are populated in the grid and reject those that don't match the filter criteria. In this case, I used the Like operator so that any records that did not contain the filter criteria would be rejected.