A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to output a report that has several record sources toa RTF fil



 
 
Thread Tools Display Modes
  #1  
Old November 30th, 2005, 10:16 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default 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  
Old November 30th, 2005, 03:46 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default 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  
Old December 3rd, 2005, 05:59 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 07:53 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.