If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to output a report that has several record sources toa RTF fil
Hi everyone,
I'd like to output a report that has several Queries as record sources to a RTF file. I have a form that has a TextBox on it to let the user choose the option (Query). The codes in the Click event of a CmdButton look like: If Me!TextBox = “Food” Then Reports![ReportName].RecordSource = “qryFood” ElseIf Me!TextBox = “Drink” Then Reports![ReportName].RecordSource = “qryDrink” End If DoCmd.OutputTo acOutputReport, "ReportName", acFormatRTF, “RTFFileName” It doesn't work. Is there anything missing? Any help is appreciated. -- Jeff |
#2
|
|||
|
|||
How to output a report that has several record sources toa RTF fil
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 -- Duane Hookom MS Access MVP -- "Jeff" wrote in message ... Hi everyone, I'd like to output a report that has several Queries as record sources to a RTF file. I have a form that has a TextBox on it to let the user choose the option (Query). The codes in the Click event of a CmdButton look like: If Me!TextBox = "Food" Then Reports![ReportName].RecordSource = "qryFood" ElseIf Me!TextBox = "Drink" Then Reports![ReportName].RecordSource = "qryDrink" End If DoCmd.OutputTo acOutputReport, "ReportName", acFormatRTF, "RTFFileName" It doesn't work. Is there anything missing? Any help is appreciated. -- Jeff |
#3
|
|||
|
|||
How to output a report that has several record sources toa RTF
Hi Duane,
It works perfectly. Thank you very much. -- 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 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 -- Duane Hookom MS Access MVP -- "Jeff" wrote in message ... Hi everyone, I'd like to output a report that has several Queries as record sources to a RTF file. I have a form that has a TextBox on it to let the user choose the option (Query). The codes in the Click event of a CmdButton look like: If Me!TextBox = "Food" Then Reports![ReportName].RecordSource = "qryFood" ElseIf Me!TextBox = "Drink" Then Reports![ReportName].RecordSource = "qryDrink" End If DoCmd.OutputTo acOutputReport, "ReportName", acFormatRTF, "RTFFileName" It doesn't work. Is there anything missing? Any help is appreciated. -- Jeff |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Has anyone seen this behaviour? What might it be? | tw | General Discussion | 4 | June 30th, 2005 03:23 PM |
Need Help In Printing Current Record in Specific Report | RNUSZ@OKDPS | Setting Up & Running Reports | 1 | May 16th, 2005 09:06 PM |
Prevent Blank Records being written. Need Help. | Robert Nusz @ DPS | Using Forms | 4 | December 29th, 2004 05:15 PM |
From a report record to the specific record in a form | Sierras | Using Forms | 1 | June 18th, 2004 02:54 PM |
Changing record sources in the report footer | Mary | Setting Up & Running Reports | 1 | June 1st, 2004 10:05 PM |