473,626 Members | 3,031 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DoCmd.OutputTo -- From SQL String?

I am building an SQL string in a subroutine and was wondering if this
could be passed directly to the docmd.outputto method as the source of
the output I wish to generate. It does not appear you can do this, but
maybe I am missing something. Thanks.

-Vincent

May 19 '06 #1
2 4650
Could you create a query for this purpose, and assign your SQL string to the
QueryDef's SQL property before calling OutputTo?

This example assumes that MyOutputQuery has been created so it can be used
for this purpose:
Dim strSql As String
strsql = "SELECT ...
dbEngine(0)(0). QueryDefs("MyOu tputQuery").SQL = strSql

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Vincent" <an**********@v erizon.net> wrote in message
news:11******** *************@i 39g2000cwa.goog legroups.com...
I am building an SQL string in a subroutine and was wondering if this
could be passed directly to the docmd.outputto method as the source of
the output I wish to generate. It does not appear you can do this, but
maybe I am missing something. Thanks.

-Vincent

May 20 '06 #2
Allen, this is exactly what I ended up doing. Thanks for the reply.

May 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2262
by: Victor Kaiser | last post by:
I am using DoCmd.OutputTo to allow users to save Access reports in snapshot format or other desired formats. Once the user selects the desired format and clicks "OK", a dialog box appears that informs the user of the progress ("Now outputting page X of...to the file...") This is fine. However, the title of the dialog box is "Printing", which is misleading since the user isn't actually printing but rather is saving data to a file. Is there...
2
8043
by: deko | last post by:
This code is behind a button that exports the contents of a query ("qryXL_Tx") to an Excel spreadsheet. It works fine the first time, but will not run a second time. When I go to look at my query... it's blank! No SQL at all.... Any ideas why this sub is eating my query?? Private Sub cmdExportXL_Click() strXLfile = "Transactions_" & strTxType & strTxAcct & strQtr & strYr & ".xls"
0
1592
by: Robert Langen | last post by:
I'm calling an Access XP application from an Outlook XP appointment form. Everything works, but the lines DoCmd.OutputTo acOutputReport, "testreport", acFormatRTF, "c:\test.rtf", False Docmd.Quit produce Access hangs. That means, the file testreport.rtf is correctly created, but Access doesn´t quit. The process msaccess.exe stays and consumes 98% processor time. If I remove the OutputTo line, Access quits perfectly.
4
6268
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 non-roman characters that I can see) don't come through right. So he needs it in Unicode formatting. He's using code for the DoCmd.OutputTo command. There's a very undocumented Encoding option for that command, but no options are specified and there's...
1
5313
by: Ryan | last post by:
Hello. I was hoping that someone may be able to assist with an issue that I am experiencing. I have created an Access DB which imports an Excel File with a particular layout and field naming. Next the user can go into a Form which basically a dynamic query with a friendly interface that eventually outputs a table that is stored in the DB as well as exported to a CSV file. The CSV file is then used with a vendor solution to fill in...
3
5492
by: ljungers | last post by:
I need to make some changes to a Query/select/print report using word application. What I need to do is change the way Word is called yet keep the process the same. Word is used so changes can be made before actual printing. Need some way of calling Word as a mail merge with the information from an Access table that the current report uses. I have seen mail merge templates that use something like <<field name>> in them that uses a table....
1
6272
by: Simon | last post by:
Dear reader, With the DoCmd.OutputTo ...... you have the possibility to write a report to an external location. In case the external location is an existing file the DoCmd is not responding with the warning "File already exist". The file will be overwrite without any warning even with the DoCmd.Setwarnings True in
2
3754
by: jmartmem | last post by:
Greetings, I have several Access 2007 reports that I regularly export to individual PDF flat files on a web server. I've successfuly created a module sub to export the reports using the DoCmd.OutputTo Macro action, but I can't seem to figure out how to run the macro automatically. I can succesfully run the macro below manually (without the IF statements), but have yet to make it work with the IF statement. Ideally, the macro will run...
16
4490
by: g diddy | last post by:
Hi, I have used the Docmd.outputto function in various places in my code but for some reason all code that comes afterwards, even msgbox doesn't show. I was just wondering if there is anything that could be causing this. For example in the snippet below the docmd command brings up a box saying that it is outputting the file to c:\FullTimetable.snp but no msgbox appears saying "test". I have about 6 or so if statements with the same problem and...
0
8259
marktang
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...
0
8192
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8696
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
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...
1
8358
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,...
0
8502
tracyyun
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...
0
7188
agi2029
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...
0
4195
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.