p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

access thread: OutPutTo Action


Message #1 by "Diahann Gooden" <dgooden@w...> on Tue, 25 Jun 2002 21:15:26
I'm trying to output an access report to MS Word using vba, OutPutTo will 
however only run and output the entire report, is there any way I can add 
criteria to this command so I can print only records that I need?

Thanks in advance
Diahann
Message #2 by ProDev <prodevmg@y...> on Tue, 25 Jun 2002 13:53:14 -0700 (PDT)
--0-1542591772-1025038394=:53626
Content-Type: text/plain; charset=us-ascii


 Create a query that limits your records and use it as the record source of the report.
 
 
  Diahann Gooden <dgooden@w...> wrote: I'm trying to output an access report to MS Word using vba, OutPutTo will 
however only run and output the entire report, is there any way I can add 
criteria to this command so I can print only records that I need?

Thanks in advance
Diahann

Lonnie Johnson 
ProDev, Builders of MS Access Databases
http://www.galaxymall.com/software/PRODEV 




---------------------------------
Do You Yahoo!?
Sign-up for Video Highlights of 2002 FIFA World Cup
Message #3 by Diahann Gooden <dgooden@w...> on Wed, 26 Jun 2002 9:10:03 -0400
	Diahann Gooden

06/26/02 08:41 AM
	=A0 =A0 =A0 =A0 To: =A0 =A0 =A0 =A0prodevmg@y...=2Ecom @ INTERNET
=A0 =A0 =A0 =A0 cc: =A0 =A0 =A0 =A0access@p...=2Ewrox=2Ecom
=A0 =A0 =A0 =A0 Subject: =A0 =A0 =A0 =A0Re: [access] Re: OutPutTo ActionLink

I tried that using the following code=2E=2E=2E=2E=2E=2E

=A0Dim stDocName As String
=A0
=A0[Report_Quality Survey Report]=2ERecordSource =3D "SELECT * FROM qGeneralFormD
ata=20
" _
=A0& "WHERE FormID =3D 49"
=A0 =A0
=A0stDocName =3D "Quality Survey Report"
=A0DoCmd=2EOpenReport stDocName, acViewPreview
=A0'DoCmd=2EOutputTo acReport, stDocName

It will neither open it nor print it when I try to change the record source=2E




	prodevmg@y...=2Ecom

06/25/02 04:53 PM
	=A0 =A0 =A0 =A0
=A0 =A0 =A0 =A0 To: =A0 =A0 =A0 =A0access@p...=2Ewrox=2Ecom @ INTERNET
=A0 =A0 =A0 =A0 cc: =A0 =A0 =A0 =A0(bcc: Diahann Gooden/Mississauga/CA/BPB)
=A0 =A0 =A0 =A0 Subject: =A0 =A0 =A0 =A0[access] Re: OutPutTo Action


=A0>Create a query that limits your records and use it as the record source of=20
the report=2E
=A0>> Diahann Gooden <dgooden@w...=2Ecom> wrote: I'm trying to output an acces
s=20
report to MS Word using vba, OutPutTo >>will however only run and output the=20
entire report, is there any way I can add criteria to this command so I can=20
print only >>records that I need?
Message #4 by ProDev <prodevmg@y...> on Wed, 26 Jun 2002 06:30:12 -0700 (PDT)
--0-1965297202-1025098212=:56735
Content-Type: text/plain; charset=us-ascii


 You could put a parameter in qGeneralFormData. You do this by putting the following in the criteria section of FormID:
[What is the ID number you wish to print?]
You must include the brackets when typing this in. If you put this in qGeneralFormData, then run the following code you will be
asked for the ID number you wish to send to a file.

 Dim stDocName As String
   
 stDocName = "Quality Survey Report"
 DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, "C:\MyFileName.doc"
Hope this helps.
 
 
  Diahann Gooden <dgooden@w...> wrote: Diahann Gooden

06/26/02 08:41 AM
        To:        prodevmg@y... @ INTERNET
        cc:        access@p...
        Subject:        Re: [access] Re: OutPutTo ActionLink

I tried that using the following code......

 Dim stDocName As String
 
 [Report_Quality Survey Report].RecordSource = "SELECT * FROM qGeneralFormData " _
 & "WHERE FormID = 49"
   
 stDocName = "Quality Survey Report"
 DoCmd.OpenReport stDocName, acViewPreview
 'DoCmd.OutputTo acReport, stDocName

It will neither open it nor print it when I try to change the record source.




prodevmg@y...

06/25/02 04:53 PM
       
        To:        access@p... @ INTERNET
        cc:        (bcc: Diahann Gooden/Mississauga/CA/BPB)
        Subject:        [access] Re: OutPutTo Action


 >Create a query that limits your records and use it as the record source of the report.
 >> Diahann Gooden wrote: I'm trying to output an access report to MS Word using vba, OutPutTo >>will however only run
and output the entire report, is there any way I can add criteria to this command so I can print only >>records that I need?


Lonnie Johnson 
ProDev, Builders of MS Access Databases
http://www.galaxymall.com/software/PRODEV 




---------------------------------
Do You Yahoo!?
Sign-up for Video Highlights of 2002 FIFA World Cup
Message #5 by "Amy Wyatt" <amyw@c...> on Thu, 27 Jun 2002 13:47:47
In order to change the record source of a report it has to be open first 
and then it can be outputted. Try something like this:

Dim strDoc as String
Dim strRS as String
Dim intID as Integer

strDoc="ReportName"
intID=5
strRS="SELECT * FROM tblTable WHERE ID=" & intID

DoCmd.OpenReport strDoc,acViewDesign
Reports(strDoc).RecordSource=strRS

DoCmd.OutputTo acOutputReport, strDoc, acFormatTXT, "C:\TestOutput.txt"
DoCmd.Close acReport,strDoc,acSaveNo

Hope this helps,

Amy

> 	Diahann Gooden

06/26/02 08:41 AM
	=A0 =A0 =A0 =A0 To: =A0 =A0 =A0 =A0prodevmg@y...=2Ecom @ INTERNET
=A0 =A0 =A0 =A0 cc: =A0 =A0 =A0 =A0access@p...=2Ewrox=2Ecom
=A0 =A0 =A0 =A0 Subject: =A0 =A0 =A0 =A0Re: [access] Re: OutPutTo 
ActionLink

I tried that using the following code=2E=2E=2E=2E=2E=2E

=A0Dim stDocName As String
=A0
=A0[Report_Quality Survey Report]=2ERecordSource =3D "SELECT * FROM 
qGeneralFormD
ata=20
" _
=A0& "WHERE FormID =3D 49"
=A0 =A0
=A0stDocName =3D "Quality Survey Report"
=A0DoCmd=2EOpenReport stDocName, acViewPreview
=A0'DoCmd=2EOutputTo acReport, stDocName

It will neither open it nor print it when I try to change the record 
source=2E




	prodevmg@y...=2Ecom

06/25/02 04:53 PM
	=A0 =A0 =A0 =A0
=A0 =A0 =A0 =A0 To: =A0 =A0 =A0 =A0access@p...=2Ewrox=2Ecom @ INTERNET
=A0 =A0 =A0 =A0 cc: =A0 =A0 =A0 =A0(bcc: Diahann Gooden/Mississauga/CA/BPB)
=A0 =A0 =A0 =A0 Subject: =A0 =A0 =A0 =A0[access] Re: OutPutTo Action


=A0>Create a query that limits your records and use it as the record 
source of=20
the report=2E
=A0>> Diahann Gooden <dgooden@w...=2Ecom> wrote: I'm trying to output 
an acces
s=20
report to MS Word using vba, OutPutTo >>will however only run and output 
the=20
entire report, is there any way I can add criteria to this command so I 
can=20
print only >>records that I need?
Message #6 by "Diahann Gooden" <dgooden@w...> on Thu, 27 Jun 2002 16:38:01
Thanks all, problem solved. I open the report in preview mode with my 
criteria, then I send that instance of the report to word with my own 
filename, then I close the report.
D...


  Return to Index