473,385 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

OutputTo command and OpenReport

Hi,

I have a database which allows users to either Print, Preview or Export their reports, using the OpenReport command for the Print and Preview and the OutputTo command for Exporting.

Everything was running smoothly until i added a wherecondition to the Docmd.OpenReport line in VBA. Now the print and preview function works fine but i have found that there is no wherecondition in the OutputTo command.

I've looked around to see if there is any way around this but no luck, is there any way of specifying this where clause when exporting ?
Jun 28 '07 #1
4 3188
JKing
1,206 Expert 1GB
Hi, I think I have a solution for you. I ran into a similar problem before where I wanted the user to have a choice between print preview or output to HTML.

strDoc = name of the report you want to open
strLinkCriteria = your where statement

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport strDoc, acViewPreview, , strLinkCriteria, acHidden
  2. DoCmd.SelectObject acReport, strDoc
  3. 'Fill in your parameters for the DoCmd.OutputTo
  4. DoCmd.OutputTo acOutputReport, strDoc, , , , 
  5. DoCmd.Close acReport, strDoc, acSaveNo
  6.  
Jun 28 '07 #2
Hi, I think I have a solution for you. I ran into a similar problem before where I wanted the user to have a choice between print preview or output to HTML.

strDoc = name of the report you want to open
strLinkCriteria = your where statement

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport strDoc, acViewPreview, , strLinkCriteria, acHidden
  2. DoCmd.SelectObject acReport, strDoc
  3. 'Fill in your parameters for the DoCmd.OutputTo
  4. DoCmd.OutputTo acOutputReport, strDoc, , , , 
  5. DoCmd.Close acReport, strDoc, acSaveNo
  6.  

Swift Reply, im impressed ! Will try it tomorrow morning..
Jun 28 '07 #3
JKing
1,206 Expert 1GB
Hope it works out for you. The print preview will be shown briefly while the report is being outputted but the last line closes that and you're left with your filtered report in the output format of your choice.
Jun 28 '07 #4
Hope it works out for you. The print preview will be shown briefly while the report is being outputted but the last line closes that and you're left with your filtered report in the output format of your choice.

Aye, it works very well thanx...
Jul 3 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: tmountjr | last post by:
I've got a user who's trying to export a text file with unicode formatting. When he exports it as straight ascii, some of the foreign characters (mostly just accent marks and the like - no...
5
by: sara | last post by:
I have reports that run from a form where the user can choose a date range, or they run automatically for a week in the "Weekly Reports" option. I created 2 queries and 2 reports - one query...
30
by: ljungers | last post by:
Anyone have an idea how I can filter a report that I'm outputting to Word. Using the following 2 Command to print and output to word. The strWhere is a list of selected items/rows to print, and...
5
by: dancole42 | last post by:
I have a question regarding the DoCmd.OutputTo function. I have an invoice report that shows all of the invoices for a particular date. I want to create a button that will export each page of...
2
by: Jim Devenish | last post by:
I have a report which can be displayed on the screen with: DoCmd.OpenReport "RemittanceAdvice",acViewNormal,,"PaymentID = " & paymentRecID I now wish to create a snapshot of this, using the...
6
by: martin DH | last post by:
**Urgent Need** I'll throw out the basics and any assistance is very, very, very much appreciated! Access 2003 on XP On a form (frmMain) is an option group of check boxes (ReportFrame) from...
1
by: pdxrichard | last post by:
Windows XP - Server 2003 - Access 2007 VBA - Code behind a form Here is my code. Why can't I find the exported file if the directories exist and there are no permission problems? Isn't a save...
1
by: MLH | last post by:
Stephen Lebans has a function named ConvertReportToPDF that I use from time to time. It's quite handy, actually. In that FN is a line that reads as follows: DoCmd.OutputTo acOutputReport,...
9
by: Carl Witte | last post by:
Hello. I'm using Access '07 and I need to regulariliy put a PDF on a FTP site. Can I do this directly with the outputto command? DoCmd.OutputTo acOutputForm, form_name, acFormatPDF,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.