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

How to append data to an existing file using DoCmd.OutputTo

18
Hi,

I have the following code which works fine in MS Access 2007. It export current access form records to an excel sheet:

DoCmd.OutputTo acOutputQuery, "RunQuery", acFormatXLSX, , True

Is it possible to append data from this form to an existing excel sheet instead of creating new one or replacing the existing one?

Your help is highly appreciated
Dec 16 '09 #1
4 6410
Delerna
1,134 Expert 1GB
I don't know if this will help you or not but.

Did you know that you can link a worksheet from an existing excel file
into the tables tab of access.
From there on you can treat the link as though it was a table.
You can uses queries/vba code in access to read,append,delete,update the data in the spreadsheet through that link. In fact, you can do anything to it that you can do with an ordinary table.
Dec 16 '09 #2
Busbait
18
Thanks Delerna for your reply , but unfortunately the link to a worksheet from an existing Excel file doesn’t help in my case

Is there any way that I can export MS Access records and append at the same time to Excel file?
Dec 17 '09 #3
Delerna
1,134 Expert 1GB
But thats what I am saying. A link to a worksheet is one way that you can export and at the same time append MS access records to an excel spreadsheet.

I don't know of any way to do that with DoCmd?

Another way might be to create an excel object in VBA and manipulate it that way.

A link is much simpler though.
using Access
Use a query to delete all data from the linked spreadsheet
Use a query to insert new data to the linked spreadsheet
Use a query to append more data to the linked spreadsheet
Use a query to update data on the spreadsheet
close access

using excel
open the spreadsheet containing the worksheet that is linked to access and there all your exported/appended data is.

I don't know your full situation of course so if you say that doesn't work for you then it doesn't work for you.

Does anyone else know of another way?
Dec 17 '09 #4
ADezii
8,834 Expert 8TB
  1. Automation Code in conjunction with the SpecialCells() Method to determine where to Append the New Data.
  2. Work from within Excel using the CopyFromRecordset() Method which copies the contents of an ADO or DAO Recordset Object onto a Worksheet, beginning at the upper-left corner of the specified Range.
  3. If you provide me with your Table/Query Name along with their Field Names and Data types, with some sample Data I'll see what I can come up with in my spare time.
Dec 17 '09 #5

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

Similar topics

8
by: Kelly Sellers | last post by:
Short version: is it possible to set OutputTo so that it will append to an existing RTF document instead of creating a new document each time? (I'm using Access XP) Full scenario: I generate...
9
by: tomblower | last post by:
Access 2000 fully updated Three PCs manage data held on a server. They each have a front-end mdb file linked to tables on the server and on each PC. A problem has arisen over the following line...
3
by: sara | last post by:
Hi - I have a button that runs 2 reports. If there is no data on the report, I use the No Data event, and tell the user, and Cancel the execution of that report. However, if the first report...
3
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...
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...
26
by: cwby1966 | last post by:
I have VBA code that is to output 2 reports to snapshot format for emailing. When I add a cancel on the report if no data, the second report will not output even when there is data ...
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...
4
by: franc sutherland | last post by:
Hello, I am using Access 2003. I am having trouble trapping the "can't append all the records in the append query" error message when appending data to a query from a table which is linked to...
0
by: Peter99 | last post by:
I'm using Access 2007 with the PDF driver installed. I have 2 reports that I want to merge into 1 PDF file. I'm using the following coding: Set mdbCurrent = CurrentDb ...
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...
1
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.