jo15765
Well-known Member
- Joined
- Sep 23, 2011
- Messages
- 591
I am in need of using VBA to import a spreadsheet to an Access table. This process works flawlessly except when the file is already open. Is there a way to set a "read only" parameter in my syntax?
This is the exact error:
Run-time error '3051':
The Microsoft Access database enginge cannot open or write to the file. It is already opened exclusively by another user or you need permission to view and write its data.
Code:
Dim filename As String, strXlsx As String
filename = "PinkPurplePile"
strXlsx = "C:\Test of Filename With Spaces.xls"
DoCmd.TransferSpreadsheet acImport, , filename, strXlsx, True, filename & "!"
This is the exact error:
Run-time error '3051':
The Microsoft Access database enginge cannot open or write to the file. It is already opened exclusively by another user or you need permission to view and write its data.