Subform filter programmatically program (Solution)

B

bchi49

Hi, I experienced a problem with programmatically changing a subform
RecordSet. The subform is filtered by the master form record even when
linking was emptied.

I turn off all the filtering, and unlink master form and sub form, and
it still doesn't work. It seems like MS Access relink it
automatically...

The solution was to programmatically code the link fields to empty.
First set the record source, then empty the link fields:

e.g.
Me.subfrmDocumentation.Form.RecordSource = sql
Me.subfrmDocumentation.Form.FilterOn = False
Me.subfrmDocumentation.Form.filter = Empty

Me.subfrmDocumentation.LinkMasterFields = Empty
Me.subfrmDocumentation.LinkChildFields = Empty

That worked for me! Please let me know if you have better solution.

Thanks,
Benjamin
 
D

david epsom dot com dot au

By the way, those properties are Text properties,
so another way of setting them to empty strings:

Me.subfrmDocumentation.Form.filter = ""
or
Me.subfrmDocumentation.Form.filter = vba.vbNullString

(david)
 
Top