473,322 Members | 1,417 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,322 software developers and data experts.

TransferSpreadsheet using a Query

Hello,

I use TransferSpreadsheet 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.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7, 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 16632
On 10 Aug 2005 07:15:12 -0700, Hank wrote:
Hello,

I use TransferSpreadsheet 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.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7, 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.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97,
"tblMileage", "C:\Practice\ExcelPractice\Practice2.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 "qrySaveForecast"

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
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", ""...
1
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...
3
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...
2
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". ...
6
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...
6
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...
1
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...
2
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...
3
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.