1
123
I see this answer in the news groups and I want to ask you question: if the
field is ((DATE)) what can I do...
my question about this expression you write
Me.[MySub].Form.Filter = "SomeField = """ & Me.[MyCombo] & """"
what can I do if the field is DATE
In form design view, right-click the edge of the subform and choose
Properties. If there is nothing in the LinkMasterFields and LinkChildFields
properties, put the name of the combo into the LinkMasterFields property,
and the name of the matching field in the subform into the LinkChildFields
property. No code is needed.
You could use the Afterupdate of the combo to filter the subform if you
wish, but the Filter belongs to the form in the subform, not to the subform
control. If the subform is named "MySub", the code would be:
Me.[MySub].Form.Filter = "SomeField = " & Me.[MyCombo]
Me.[MySub].Form.FilterOn = True
Notes:
1. If the field is a Text type field, you need extra quotes:
Me.[MySub].Form.Filter = "SomeField = """ & Me.[MyCombo] & """"
2. If the main form is bound and has its own filter sometimes, be aware that
Access fails to maintain the FilterOn property correctly for both the main
form and the subform.
field is ((DATE)) what can I do...
my question about this expression you write
Me.[MySub].Form.Filter = "SomeField = """ & Me.[MyCombo] & """"
what can I do if the field is DATE
In form design view, right-click the edge of the subform and choose
Properties. If there is nothing in the LinkMasterFields and LinkChildFields
properties, put the name of the combo into the LinkMasterFields property,
and the name of the matching field in the subform into the LinkChildFields
property. No code is needed.
You could use the Afterupdate of the combo to filter the subform if you
wish, but the Filter belongs to the form in the subform, not to the subform
control. If the subform is named "MySub", the code would be:
Me.[MySub].Form.Filter = "SomeField = " & Me.[MyCombo]
Me.[MySub].Form.FilterOn = True
Notes:
1. If the field is a Text type field, you need extra quotes:
Me.[MySub].Form.Filter = "SomeField = """ & Me.[MyCombo] & """"
2. If the main form is bound and has its own filter sometimes, be aware that
Access fails to maintain the FilterOn property correctly for both the main
form and the subform.