View Full Version : Search subform


nigelh
01-23-2002, 02:58 AM
I have created an asset database, the main form contains details on all assets. Within the main form there is a sub form, incidents, this details any incidents associated with that asset, the one to many relationship is set up using the asset id. I want to perform searches on such things as incident number, open incidents etc., then display the main forms with sub-forms that satisfy the search.
I've tried all sorts but don't seem to be getting anywhere. Any help, tips would be great.
Thanks.

GTrice
01-24-2002, 03:43 PM
A sub form, by nature and design, is limited to the Parent record relationship. In order to search thru all subform records you should create another form (called from a command button) from the Parent form. It will open the form that has all of the subform records (Child) that can then be searched. Adding a flag field (text 1 or y/n) to the Child table will allow you to tag the fields that meet your search criteria. Then you can repen the Original Parent form filtered on the children whose Flag Field meets your criteria. I would also have a command button appear when filtered to remove the filter. Use set visibility to show and hide the Command Button. Call the visibility of this command button from the On Open event. Hope this helps