Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exporting Data from Excel to Access Problems

I've been trying to automate in Visual Basic the transfer
of data from Excel to Access. I have created an Excel
spreadsheet that multiple users use at the same time.
They import data from Access (using MS Query and it works
real well) and they produce output that needs to be sent
back to the same Access database. I have written VB code
in Excel to open the Access database and to use the
Transferspreadsheet Method from Access to pull in the
data. This works great provided the database is not
already opened by the user or someone else. The problem
that I have is that either the user gets an error message
that the database is opened by someone else and is it
locked out to them, or the changes in the spreadsheet are
not transfered but the data on the currently saved
version on the server is transfered.

Is there a way to do this in a multiple user environment?

Here is some sample code that I am using.

Set appMS = GetObject("G:\Database.mdb")
appMS.Application.DoCmd.TransferSpreadsheet acImport, _
acSpreadsheetTypeExcel9, _
"Employees","G:\Excel\Template.xls", True, "A1:G12"
appMS.Application.Quit
Set appMS = Nothing

Any help would be greatly aprreciated.

Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Exporting Data from Excel to Access Problems

Mike,

You should be using DAO or ADO to retrieve the data from Access. This does
not require that the entire Access application be opened, so you shouldn't
get a runtime error if someone else has the database open. You can read the
data from the Employees table into a Recordset object, which you can then
copy to the desired Excel range using the CopyFromRecordset method in Excel.
Doing some google and groups.google.com searches on "Access", "ADO",
"CopyFromRecordset", and "Excel" should get you some relevant information.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Mike wrote:
I've been trying to automate in Visual Basic the transfer
of data from Excel to Access. I have created an Excel
spreadsheet that multiple users use at the same time.
They import data from Access (using MS Query and it works
real well) and they produce output that needs to be sent
back to the same Access database. I have written VB code
in Excel to open the Access database and to use the
Transferspreadsheet Method from Access to pull in the
data. This works great provided the database is not
already opened by the user or someone else. The problem
that I have is that either the user gets an error message
that the database is opened by someone else and is it
locked out to them, or the changes in the spreadsheet are
not transfered but the data on the currently saved
version on the server is transfered.

Is there a way to do this in a multiple user environment?

Here is some sample code that I am using.

Set appMS = GetObject("G:\Database.mdb")
appMS.Application.DoCmd.TransferSpreadsheet acImport, _
acSpreadsheetTypeExcel9, _
"Employees","G:\Excel\Template.xls", True, "A1:G12"
appMS.Application.Quit
Set appMS = Nothing

Any help would be greatly aprreciated.

Thanks.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting data to Excel pivot table from Access Pat Dools Excel Discussion (Misc queries) 3 October 22nd 08 06:49 PM
Exporting selected data from Access to Excel Linda Excel Discussion (Misc queries) 1 November 6th 07 05:04 PM
exporting data from access to excel [email protected] Excel Discussion (Misc queries) 1 April 11th 06 10:17 AM
Exporting data from access to excel vinayak Excel Worksheet Functions 0 April 11th 06 08:20 AM
Exporting data in Excel permanently to Access WDR Links and Linking in Excel 1 January 12th 06 03:56 AM


All times are GMT +1. The time now is 09:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"