Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / December 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff - 30 Nov 2005 10:16 GMT
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.

Signature

Jeff

Duane Hookom - 30 Nov 2005 15:46 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.