I need to save a report to an RTF and I am using OutputTo acReport:
DoCmd.OutputTo acReport, stDocName, acFormatRTF, TodaysDir & "-" &
"Name.rtf"
This command saves the report nicely, however I cannot filter the report
like I can on an OpenReport and providing a filter statement. Has anyone
found a good way to do this.
I do not want my user to open and preview the report. It must be done
programmaticall y.
I am using Access 2002.
Please advise.
Thanks in advance 4 10052
"John Galt" <js**@yahoo.com > wrote in news:ePBTb.1124 2$Bv6.3291854
@news1.epix.net : I need to save a report to an RTF and I am using OutputTo acReport:
DoCmd.OutputTo acReport, stDocName, acFormatRTF, TodaysDir & "-" & "Name.rtf"
This command saves the report nicely, however I cannot filter the report like I can on an OpenReport and providing a filter statement. Has anyone found a good way to do this.
I do not want my user to open and preview the report. It must be done programmaticall y.
I am using Access 2002.
Please advise.
Thanks in advance
One way is to set the RecordSource of your report to a saved query. Before
opening the report, modify the SQL of the query as in:
Const qryChargesName As String = "qryCharges "
Function fCreateAccountF ile(strAccountN umber As String)
Dim qdf As QueryDef
Dim rcs As Recordset
Dim strFullPath As String
Set qdf = DBEngine(0)(0). QueryDefs(qryCh argesName)
With qdf
.SQL = "SELECT * FROM tblCharges WHERE Sent = No And Account = " &
_
Chr(34) & strAccountNumbe r & Chr(34)
Set rcs = .OpenRecordset
With rcs
If .RecordCount <> 0 Then
strFullPath = Environ("temp") & _
"\" & "Chargeable Messages for " & strAccountNumbe r &
".rtf"
DoCmd.OutputTo _
acOutputReport, "rptCharges ", acFormatRTF, strFullPath,
False
End If
End With
End With
Set rcs = Nothing
Set qdf = Nothing
End Function
Sub test()
fCreateAccountF ile "905 690-2185"
End Sub
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
I tried this and I get an error on the dim querydef statement.
It is not a choice in Access 2002 or I am missing something.
I get "User defined type not defined"
????
"Lyle Fairfield" <Mi************ @Invalid.Com> wrote in message
news:Xn******** ***********@130 .133.1.4... "John Galt" <js**@yahoo.com > wrote in news:ePBTb.1124 2$Bv6.3291854 @news1.epix.net :
I need to save a report to an RTF and I am using OutputTo acReport:
DoCmd.OutputTo acReport, stDocName, acFormatRTF, TodaysDir & "-" & "Name.rtf"
This command saves the report nicely, however I cannot filter the report like I can on an OpenReport and providing a filter statement. Has
anyone found a good way to do this.
I do not want my user to open and preview the report. It must be done programmaticall y.
I am using Access 2002.
Please advise.
Thanks in advance
One way is to set the RecordSource of your report to a saved query. Before opening the report, modify the SQL of the query as in:
Const qryChargesName As String = "qryCharges " Function fCreateAccountF ile(strAccountN umber As String) Dim qdf As QueryDef Dim rcs As Recordset Dim strFullPath As String Set qdf = DBEngine(0)(0). QueryDefs(qryCh argesName) With qdf .SQL = "SELECT * FROM tblCharges WHERE Sent = No And Account = " & _ Chr(34) & strAccountNumbe r & Chr(34) Set rcs = .OpenRecordset With rcs If .RecordCount <> 0 Then strFullPath = Environ("temp") & _ "\" & "Chargeable Messages for " & strAccountNumbe r & ".rtf" DoCmd.OutputTo _ acOutputReport, "rptCharges ", acFormatRTF, strFullPath, False End If End With End With Set rcs = Nothing Set qdf = Nothing End Function
Sub test() fCreateAccountF ile "905 690-2185" End Sub
-- Lyle (for e-mail refer to http://ffdba.com/contacts.htm)
"John Galt" <js**@yahoo.com > wrote in
news:W6******** *************@n ews1.epix.net: I tried this and I get an error on the dim querydef statement. It is not a choice in Access 2002 or I am missing something. I get "User defined type not defined"
????
"Lyle Fairfield" <Mi************ @Invalid.Com> wrote in message news:Xn******** ***********@130 .133.1.4... "John Galt" <js**@yahoo.com > wrote in news:ePBTb.1124 2$Bv6.3291854 @news1.epix.net :
> I need to save a report to an RTF and I am using OutputTo acReport: > > DoCmd.OutputTo acReport, stDocName, acFormatRTF, TodaysDir & "-" > & > "Name.rtf" > > This command saves the report nicely, however I cannot filter the > report like I can on an OpenReport and providing a filter statement. > Has anyone > found a good way to do this. > > I do not want my user to open and preview the report. It must be > done programmaticall y. > > I am using Access 2002. > > Please advise. > > Thanks in advance
One way is to set the RecordSource of your report to a saved query. Before opening the report, modify the SQL of the query as in:
Const qryChargesName As String = "qryCharges " Function fCreateAccountF ile(strAccountN umber As String) Dim qdf As QueryDef Dim rcs As Recordset Dim strFullPath As String Set qdf = DBEngine(0)(0). QueryDefs(qryCh argesName) With qdf .SQL = "SELECT * FROM tblCharges WHERE Sent = No And Account = " & _ Chr(34) & strAccountNumbe r & Chr(34) Set rcs = .OpenRecordset With rcs If .RecordCount <> 0 Then strFullPath = Environ("temp") & _ "\" & "Chargeable Messages for " & strAccountNumbe r & ".rtf" DoCmd.OutputTo _ acOutputReport, "rptCharges ", acFormatRTF, strFullPath, False End If End With End With Set rcs = Nothing Set qdf = Nothing End Function
Sub test() fCreateAccountF ile "905 690-2185" End Sub
-- Lyle (for e-mail refer to http://ffdba.com/contacts.htm)
Set a reference to dao and qualify the qdf with dao as in
DAO.Qdf
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Thanks.
I did get it working now!
"Lyle Fairfield" <Mi************ @Invalid.Com> wrote in message
news:Xn******** **********@130. 133.1.4... "John Galt" <js**@yahoo.com > wrote in news:W6******** *************@n ews1.epix.net:
I tried this and I get an error on the dim querydef statement. It is not a choice in Access 2002 or I am missing something. I get "User defined type not defined"
????
"Lyle Fairfield" <Mi************ @Invalid.Com> wrote in message news:Xn******** ***********@130 .133.1.4... "John Galt" <js**@yahoo.com > wrote in news:ePBTb.1124 2$Bv6.3291854 @news1.epix.net :
> I need to save a report to an RTF and I am using OutputTo acReport: > > DoCmd.OutputTo acReport, stDocName, acFormatRTF, TodaysDir & "-" > & > "Name.rtf" > > This command saves the report nicely, however I cannot filter the > report like I can on an OpenReport and providing a filter statement. > Has anyone > found a good way to do this. > > I do not want my user to open and preview the report. It must be > done programmaticall y. > > I am using Access 2002. > > Please advise. > > Thanks in advance
One way is to set the RecordSource of your report to a saved query. Before opening the report, modify the SQL of the query as in:
Const qryChargesName As String = "qryCharges " Function fCreateAccountF ile(strAccountN umber As String) Dim qdf As QueryDef Dim rcs As Recordset Dim strFullPath As String Set qdf = DBEngine(0)(0). QueryDefs(qryCh argesName) With qdf .SQL = "SELECT * FROM tblCharges WHERE Sent = No And Account = " & _ Chr(34) & strAccountNumbe r & Chr(34) Set rcs = .OpenRecordset With rcs If .RecordCount <> 0 Then strFullPath = Environ("temp") & _ "\" & "Chargeable Messages for " & strAccountNumbe r & ".rtf" DoCmd.OutputTo _ acOutputReport, "rptCharges ", acFormatRTF, strFullPath, False End If End With End With Set rcs = Nothing Set qdf = Nothing End Function
Sub test() fCreateAccountF ile "905 690-2185" End Sub
-- Lyle (for e-mail refer to http://ffdba.com/contacts.htm)
Set a reference to dao and qualify the qdf with dao as in DAO.Qdf
-- Lyle (for e-mail refer to http://ffdba.com/contacts.htm) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Richard |
last post by:
Hi,
I have a form based on a table. When I filter the form I want to run a
report based on the same table with the same filter as the form. No problem
until I want to filter a combo box where the text value is on a different
table. The me.filter is then a text instead of the id-number from the lookup
table. This causes the report to prompt for the parameter.
How do I get by this problem? Do I need to create a temporary table? I
rather...
|
by: Vikrant |
last post by:
Hey Friends
I need to export an Access Report using a filter.
I am using the method OutputTo
m_pDoCmd->OutputTo(
3, // asOutputReport
COleVariant(strReportName), // <report name>
COleVariant(_T("HTML (*.html)")), // acFormatHTML
|
by: MGFoster |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've converted an ACC97 .mdb file to an ACC2K2 .adp. A report that
worked in ACC97 doesn't work in ACC2K2.
Report setup:
ACC97 ACC2K2 (SP-2)
-------------- ---------------------------
|
by: David Horsman |
last post by:
I have a report that lists File-B. My macro runs this
report using a query as a filter. The query uses two files,
the parent File-B and with a 0-many relationship to File-C.
The query selects for a specific field value on one field in
File-C.
The query works fine alone and the report is fine if run by
itself. However when I run the macro using the query as a
filter I get a parameter prompt to enter a value for the
field in File-C.
|
by: lorirobn |
last post by:
Hi,
I have a report that works just fine.
Now I would like to add the capability to choose selection criteria to
limit what is displayed. I created several reports that do this, but
they used VBA to create SQL statements, then apply them. Now that I
have been using Access/VBA for awhile, I am wondering if there is a
simpler way to do this than coding these long sql statements.
My report has a query as its record source. Can I just...
| |
by: dfw1417 |
last post by:
I have used a query and report filter to return records related to a specific account id. I want to print a report including only the latest 6 records out of the set returned by the record filter. I have set the sort order for the report on descending thus returning the latest records at the top of the report. However since there are well over 6 records related to the account number the report contains all the related records.
I have been...
|
by: Cara Murphy |
last post by:
Hi There!
Hoping you are able to help me with a filtering scenario:
I have created a pop up form (Filter) to filter a report (Open Issues), which currently has a number of combo boxes which apply the filters to the fields in the report.
I would like to use this form to filter the report within a date range (Raised Date From and Raised Date To), using unbound text boxes, without having to specify the criteria within the report's...
|
by: Fran |
last post by:
I recently tried to use code for "Use a multi-select list box to
filter a report" from Allen Browne in my database. I was able to add
the code and adapt it to my needs, however I am getting an error.
I click Ok and the report opens.
I look in the design view and the filter is there but the IN equals
"" (it is blank, the values are not in there)
|
by: Andrew Meador |
last post by:
I have a form (Change Card List by Status) with a check box
(cboNOT) and a list box (lstStatus). There is an Open Report button
that opens a report (Report - Change Card List) which uses a query
(SQL -Change Card List).
What I want to do is have the form open the report where a filter
is set to use the values from the check box AND the value selected
from the list box to generate the report.
What I can't figure out is how to use the...
|
by: franc sutherland |
last post by:
Hello,
I have a report which I filter using the me.filter command in the
OnOpen event.
Me.Filter = "OrderID=" & Forms!variable_form_name!
Me.FilterOn = True
I want to be able to open that report, filtered, from different
forms. How do I carry the name of the current form into the
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |