473,545 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TransferSpreads heet using a Query

Hello,

I use TransferSpreads heet on a daily basis using a Table as a
datasource. I was under the impression from reading Help that you could
also use a Query as the datasource. This is my code: (simplified here)

strSQL = "SELECT [Part Number] FROM [Orders];"

DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel7, strSQL,
Path, True

I get an error message:
Microsoft could not find the object: "SELECT [Part Number] FROM
[Orders];"

I tried saving it as a query and used the Query Name and got the same
result.

What am I missing?
Thanks,
Hank Reed

Nov 13 '05 #1
2 16727
On 10 Aug 2005 07:15:12 -0700, Hank wrote:
Hello,

I use TransferSpreads heet on a daily basis using a Table as a
datasource. I was under the impression from reading Help that you could
also use a Query as the datasource. This is my code: (simplified here)

strSQL = "SELECT [Part Number] FROM [Orders];"

DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel7, strSQL,
Path, True

I get an error message:
Microsoft could not find the object: "SELECT [Part Number] FROM
[Orders];"

I tried saving it as a query and used the Query Name and got the same
result.

What am I missing?
Thanks,
Hank Reed


This works for me.

DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel97,
"tblMileage ", "C:\Practice\Ex celPractice\Pra ctice2.xls", True

"tblMileage " is the name of the query.
Did you place yours within quote marks?

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #2
Fred,

Perfect, but, of course its "qrySaveForecas t"

Never occured to me to delimit it with quotes.

I prefer embedded SQL statements but this works.

Thanks,
Hank Reed

Nov 13 '05 #3

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

Similar topics

1
4193
by: O'Donnell Tribunal | last post by:
Hello Everybody, I am using the TransferSpreadsheet method to import spreadsheets for processing. say my code looks like this: DoCmd.TransferSpreadsheet acImport, 0, _ "tbltempImport1", "" & strFileExtn, False, "Spreadheet1!A1:D30"
1
6176
by: barma16 | last post by:
I've hit a bit of a brick wall here, and could use some advice. I have an Access application whose output is a four-tab Excel spreadsheet where three of the four tabs are the result of database queries. A number of fields in the queries are designed to become formulae in Excel after the export has taken place (and they need to be in Excel...
3
11050
by: user_5701 | last post by:
Hello, I'm getting an error with a Docmd.Transferspreadsheet line of code: DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel2000, "tblTest", pathAndFilename, True The above line works perfectly fine, but when I change the table name argument (tblTest) to the name of a query, it fails and gives the following error:
2
10595
by: Anne Sachleben via AccessMonster.com | last post by:
I am using the TransferSpreadsheet function to export a query result to a specific worksheet in an Excel file titled "report". I want the result to be exported to the worksheet titled "facts". Here are the parameters I entered: Transfer Type: Export Spreadsheet Type: Microsoft Excel 8-10 Table Name: facts query File Name: C:\report.xls...
6
2672
by: shumaker | last post by:
I have a form in an Access Project that displays some records, and based on the displayed records I'd like to output this to an excel file, but I need to write more fields of the record than are shown in the form. I'm not sure how I would do this. I was considering creating a query that has the fields I want to use in it, but because the...
6
8164
by: sara | last post by:
I have a procedure to automate bringing several Excel files into our Access tables, on a daily basis. The problem is that if the user has a problem, and tries to run the import again (maybe 3 files imported then there was a data problem and they want to re-import after fixing the problem), I can't get the Error handling to fire if the user...
1
3975
by: Brad | last post by:
Thanks for taking the time to read my question. I want to use SQL in the TransferSpreadsheet Method, but I can't get it to work. I don't know why, because I've done a debug.pring on the same code to see what the code resolves to and it looks just like the select statement in the query I based it on. I want SQL in there so that it can...
2
3055
by: RZ15 | last post by:
Hi, I am trying to use the transferspreadsheet command to transfer a table into an excel file i have. I'm using the following code: Private Sub cmdOK_Click() 'Run Make-Table query without warnings so I can export the updated table later DoCmd.SetWarnings False DoCmd.OpenQuery "qryPriLis", acViewNormal DoCmd.Close...
3
10957
by: Icarus | last post by:
I'm using TransferSpreadsheet to import an Excel file in to MS Access 2003. DoCmd.TransferSpreadsheet acImport, 8, strTable, strFileName, True, "" One of the columns in the Excel file is a number formatted field, but occasionally a cell in that column will not have a value. When that happens, the code is not returning an error, but I...
0
7478
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...
0
7410
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...
0
7923
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...
1
7437
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...
0
5984
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...
1
5343
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3466
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
722
bsmnconsultancy
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...

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.