We help IT Professionals succeed at work.

have a error when i try to export data from access to 2010 via vba

Medium Priority
790 Views
Last Modified: 2012-08-14
hi how want to export a query and the name from the query is temp and i want to export it to excel in this location i:\database, and this is my vba code
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "temp", "I:\Importand Database", True
 but i get an error message
run time error   3051
 The Microsoft Access database engine cannot open or write to the file
'I:\databases. It is already opened exclusively by another
user, or you need permission to view and write its data.
_______________________________________

i'm the owner from the computer so it's don't to be any promession problem i have windows 7 ultimate with office 2010
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016
Commented:
include the name of the excel file

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "temp", "I:\Importand Database\myExcel.xls", True
CERTIFIED EXPERT
Top Expert 2016

Commented:
also make sure that the folder "I:\Importand Database" exists

Author

Commented:
thanks a lot

Explore More ContentExplore courses, solutions, and other research materials related to this topic.