I assume the button's click event. Use this code instead of
the OpenForm, where ever that was.
--
Marsh
MVP [MS Access]
Lisa wrote:
>If I want to use the
> strSQL = "SELECT . . . FROM table WHERE "& stLinkCriteria
> Me.subformcontrol.Form.RecordSource = strSQL
>
>way, where do I put this code - onClick for the button??
>
>
>> Lisa wrote:
>> >I have 4 unbound combo boxes that limit the records I want to display, I
>> >have them working for a new form, but would like to display the info in a
>> >subform when a button called See_Schedule is clicked. Right now I have a
>> >series of if statements that builds the appropriate stLinkCriteria before the
>> >line:
>> > DoCmd.OpenForm stDocName, , , stLinkCriteria
>> >
>> >How can I use the same logic to link to a subform??
>>
>>
>"Marshall Barton" wrote:
>> In some simple situations, you can assigne the criteria
>> string to the subform's Filter property:
>>
>> Me.subformcontrol.Form.Filter = stLinkCriteria
>> Me.subformcontrol.Form.FilterOn = True
>>
>> But there may be issues doing that, so I prefer to set the
>> subform RecordSource property:
>>
>> strSQL = "SELECT . . . FROM table WHERE "& stLinkCriteria
>> Me.subformcontrol.Form.RecordSource = strSQL
|