I have a subform object that, depending on user input, will display one of several forms. Two are continuous list-type forms, the others display details of a single record.
My problem is that using the SourceObject, LinkMasterFields and LinkChildFields properties of the subform doesn't seem to be of much use when you need to change those properties on the fly. It appears that as soon as you set the SourceObject property the named form is immediately opened, which means that if the query underlying the form returns 3000 records then that's what's going to happen until the LinkMasterFields and LinkChildFields properties are then set. I thought it would be possible to set the SourceObject, LinkMasterFields and LinkChildFields properties to "" (or Nothing) and then set the LinkMasterFields and LinkChildFields properties before specifying the SourceObject, but it doesn't work like that.
It seems I am going to have to drop the idea of using the LinkMasterFields and LinkChildFields properties and instead set the RecordSource for each form that may appear in the SubForm to return zero records. Then once that form is set as the SubForm's SourceObject I will need to call a procedure local to the form that will amend the forms RecordSource with the criteria pointing to the relevant field on the Parent form. But such an approach doesn't seem that efficient.
Does anyone have any thoughts or advice on this aspect of using a subform object for displaying multiple forms?
My problem is that using the SourceObject, LinkMasterFields and LinkChildFields properties of the subform doesn't seem to be of much use when you need to change those properties on the fly. It appears that as soon as you set the SourceObject property the named form is immediately opened, which means that if the query underlying the form returns 3000 records then that's what's going to happen until the LinkMasterFields and LinkChildFields properties are then set. I thought it would be possible to set the SourceObject, LinkMasterFields and LinkChildFields properties to "" (or Nothing) and then set the LinkMasterFields and LinkChildFields properties before specifying the SourceObject, but it doesn't work like that.
It seems I am going to have to drop the idea of using the LinkMasterFields and LinkChildFields properties and instead set the RecordSource for each form that may appear in the SubForm to return zero records. Then once that form is set as the SubForm's SourceObject I will need to call a procedure local to the form that will amend the forms RecordSource with the criteria pointing to the relevant field on the Parent form. But such an approach doesn't seem that efficient.
Does anyone have any thoughts or advice on this aspect of using a subform object for displaying multiple forms?