Wrox Programmer Forums
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 17th, 2003, 11:50 AM
Registered User
Join Date: Dec 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Exporting data to Excel

I am trying to export data from Access to Excel and then subsequently send the data via Outlook to particular users. Using the following code, I was able to get the data to export once, but can't seem to get it to export again. I receive the following error:

Run-time error 3422: Can't modify table structure. Another user has the table open.

    Function ExporttoExcel()
    'Open Excel Workbook, export the data, then close the wkbk.

    Dim openWorkbook As Object, name As String
    Set openWorkbook = Workbooks.Open("D:\Recertifications.xls")

        DoCmd.TransferSpreadsheet acExport, _
                SpreadsheetType:=acSpreadsheetTypeExcel9, _
                TableName:="Recertifications", _
                FileName:="D:\Recertifications.xls", _


    End Function

ANY help to get this working properly would be great!
Old December 23rd, 2003, 09:45 AM
Registered User
Join Date: Dec 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

I fixed my own problem by doing the export a different way. I used an event procedure on a form called Month:

DoCmd.OutputTo acQuery, "qry_month", "MicrosoftExcel(*.xls)", "D:\Recertifications.xls"

However, now I need to filter this data to a particular month the user chooses in a control(Combo26 which lets the user choose a month) on a form (Month).

In qry_month which is getting exported, I created a field called RecertMonth which returns only the month of the expiration date. In the criteria for this field, I used:

I thought this was correct, but I get the following error:

The action or method is invalid because the form or report
isn't bound to a table or query.

I attempted to make the control bound, but that resulted in nothing being exported. Any suggestions on where I am going wrong?
Old October 29th, 2004, 12:37 AM
Registered User
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

I want to exprt data from MS-Access to MS-Excel using Java programming.
Any one can help to do this.


Old February 10th, 2011, 01:27 AM
Registered User
Join Date: Feb 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

I want to introduce one article about how to export data from database to Excel, Word, PDF and so on. It mainly shows us how to use a small tool and provides an address for download the free component, you can read this article on http://www.codeproject.com/KB/cs/Exc...ExportWiz.aspx

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting data from datagrid to excel??? twyce C# 3 March 4th, 2010 04:51 AM
help exporting data to excel MarkGT Classic ASP Basics 5 April 29th, 2008 06:13 PM
Exporting Query Data From Access to Excel JimInSouthernCal Access VBA 3 December 21st, 2007 08:34 AM
Exporting data to excel sheet x_ray VB.NET 2002/2003 Basics 0 January 6th, 2006 03:14 PM
Exporting data from a repeater to an Excel sheet see07 ASP.NET 1.x and 2.0 Application Design 7 January 17th, 2005 03:46 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.