You can't change the RecordSource property of a closed report. You can
change the SQL of a saved query that is the RecordSource of a report that is
closed.
Dim strSQL as String
If Me!textbox="Food" Then
strSQL = "SELECT * FROM qryFood;"
ElseIf Me!TextBox = "Drink" Then
strSQL = "SELECT * FROM qryDrink;"
End If
CurrentDb.QueryDefs("qryMyReportRS").SQL = strSQL

Signature
Duane Hookom
MS Access MVP
--
> Hi everyone,
>
[quoted text clipped - 13 lines]
>
> It doesn't work. Is there anything missing? Any help is appreciated.
Jeff - 03 Dec 2005 05:59 GMT
Hi Duane,
It works perfectly. Thank you very much.

Signature
Jeff
"Duane Hookom" 來函:
> You can't change the RecordSource property of a closed report. You can
> change the SQL of a saved query that is the RecordSource of a report that is
[quoted text clipped - 26 lines]
> >
> > It doesn't work. Is there anything missing? Any help is appreciated.