473,396 Members | 2,034 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,396 software developers and data experts.

access -> excel

Hello together,

I simply want to export table data to a new excel file without saving
this file to local hard disk drive, the user should decide where to
store.

Alltogether, the excel sheet should only exist in memory

Thanks, Karsten

Previous solution: Exporting custom query to Temp-File

'Custom-Query
gszPersonenQuery = "SELECT table1.* FROM ... INNER "

Dim qTemp As QueryDef
Dim szSQL As String

Set qTemp = CurrentDb.QueryDefs("aTemp")
qTemp.sql = gszPersonenQuery
DoCmd.OutputTo acOutputQuery, "aTemp", acFormatXLS,
"C:\Personen.xls"

Jun 26 '06 #1
3 2129
File>Export, change type to Excel
<ke******@web.de> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hello together,

I simply want to export table data to a new excel file without saving
this file to local hard disk drive, the user should decide where to
store.

Alltogether, the excel sheet should only exist in memory

Thanks, Karsten

Previous solution: Exporting custom query to Temp-File

'Custom-Query
gszPersonenQuery = "SELECT table1.* FROM ... INNER "

Dim qTemp As QueryDef
Dim szSQL As String

Set qTemp = CurrentDb.QueryDefs("aTemp")
qTemp.sql = gszPersonenQuery
DoCmd.OutputTo acOutputQuery, "aTemp", acFormatXLS,
"C:\Personen.xls"

Jun 26 '06 #2
Use the ADO method in a Excel macro. Data is imported into the current
spreadsheet and if the user wants it saved he may do so or not save and it is
gone.
Not knowing you data structure, here are the basics for the Excel macro:

Sub OpenaRecoedset()
Dim rst As ADODB.Recordset

Set rst = New Recordset

Range("A1").Select

rst.Open "SELECT * FROM table name", _
"DRIVER=Microsoft Access Driver (*.mdb);" & _
"DBQ=path of the access database;", _
adOpenKeyset, adLockPessimistic

ActiveCell.Offset(0, 1) = rst.Fields("Field1").Value
ActiveCell.Offset(0, 2) = rst.Fields("Field2").Value
ActiveCell.Offset(0, 3) = rst.Fields("Field3").Value

rst.MoveNext

rst.Close
End Sub

Of course you will need to substitute the table's name and the path ot the db
where it says in the code I have posted.

ke******@web.de wrote:
Hello together,

I simply want to export table data to a new excel file without saving
this file to local hard disk drive, the user should decide where to
store.

Alltogether, the excel sheet should only exist in memory

Thanks, Karsten

Previous solution: Exporting custom query to Temp-File

'Custom-Query
gszPersonenQuery = "SELECT table1.* FROM ... INNER "

Dim qTemp As QueryDef
Dim szSQL As String

Set qTemp = CurrentDb.QueryDefs("aTemp")
qTemp.sql = gszPersonenQuery
DoCmd.OutputTo acOutputQuery, "aTemp", acFormatXLS,
"C:\Personen.xls"


--
Message posted via http://www.accessmonster.com
Jun 26 '06 #3
Oops.
Add:
i = 0 after Range("A1").Select

Do Until rst.EOF
i = i + 1 after adOpenKeyset, adLockPessimistic

Loop after rst.MoveNext

jahoobob wrote:
Use the ADO method in a Excel macro. Data is imported into the current
spreadsheet and if the user wants it saved he may do so or not save and it is
gone.
Not knowing you data structure, here are the basics for the Excel macro:

Sub OpenaRecoedset()
Dim rst As ADODB.Recordset

Set rst = New Recordset

Range("A1").Select

rst.Open "SELECT * FROM table name", _
"DRIVER=Microsoft Access Driver (*.mdb);" & _
"DBQ=path of the access database;", _
adOpenKeyset, adLockPessimistic

ActiveCell.Offset(0, 1) = rst.Fields("Field1").Value
ActiveCell.Offset(0, 2) = rst.Fields("Field2").Value
ActiveCell.Offset(0, 3) = rst.Fields("Field3").Value

rst.MoveNext

rst.Close
End Sub

Of course you will need to substitute the table's name and the path ot the db
where it says in the code I have posted.
Hello together,

[quoted text clipped - 18 lines]
DoCmd.OutputTo acOutputQuery, "aTemp", acFormatXLS,
"C:\Personen.xls"


--
Message posted via http://www.accessmonster.com
Jun 26 '06 #4

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

Similar topics

63
by: Jerome | last post by:
Hi, I'm a bit confused ... when would I rather write an database application using MS Access and Visual Basic and when (and why) would I rather write it using Visual Studio .Net? Is it as easy...
13
by: bill | last post by:
I am trying to convince a client that dotNet is preferable to an Access project (ADP/ADE). This client currently has a large, pure Access MDB solution with 30+ users, which needs to be upgraded....
1
by: Dave | last post by:
Hello NG, Regarding access-declarations and member using-declarations as used to change the access level of an inherited base member... Two things need to be considered when determining an...
13
by: Simon Bailey | last post by:
I am a newcomer to databases and am not sure which DBMS to use. I have a very simplified knowledge of databases overall. I would very much appreciate a (simplifed) message explaining the advantages...
0
by: Frederick Noronha \(FN\) | last post by:
---------- Forwarded message ---------- Solutions to Everyday User Interface and Programming Problems O'Reilly Releases "Access Cookbook, Second Edition" Sebastopol, CA--Neither reference book...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
20
by: Olav.NET | last post by:
I am a .NET/C++ developer who is supposed to do some work with Access. I do not know much about it except for the DB part. Questions: *1* I am looking for INTENSIVE books to get quickly up to...
47
by: ship | last post by:
Hi We need some advice: We are thinking of upgrading our Access database from Access 2000 to Access 2004. How stable is MS Office 2003? (particularly Access 2003). We are just a small...
64
by: John | last post by:
Hi What future does access have after the release of vs 2005/sql 2005? MS doesn't seem to have done anything major with access lately and presumably hoping that everyone migrates to vs/sql. ...
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...
0
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,...
0
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...
0
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,...

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.