Hi All,
I am a newbie to VBA coding and am trying to do a relatively simple thing. I am attempting to automate the process of importing an Excel spreadsheet into an Access database, run a couple of queries against the data in the newly imported table, then export the resulting reports to Word format if possible.
Below is the code I am using:
***********************************************************
Function GET_EXPORT_DATA()
On Error GoTo GET_EXPORT_DATA_Err
CurrentDb.Execute "Delete * from [Export Scorecard]"
DoCmd.TransferSpreadsheet acImport, 8, "Export Scorecard", "T:\BIM\BPM\_ExportDB", True, ""
DoCmd.OpenQuery "CTE Query", acViewNormal, acEdit
DoCmd.OpenQuery "DayToPGI", acViewNormal, acEdit
GET_EXPORT_DATA_Exit:
Exit Function
GET_EXPORT_DATA_Err:
MsgBox Error$
Resume GET_EXPORT_DATA_Exit
End Function
******************************************************
The problem is that when I try to run it, I get the error message below:
'The Microsoft Jet Engine cannot open the file “”. It is opened exclusively by another user, or you need permission to view the file.'
Any assistance provided would be greatly appreciated. Thanks!
I am a newbie to VBA coding and am trying to do a relatively simple thing. I am attempting to automate the process of importing an Excel spreadsheet into an Access database, run a couple of queries against the data in the newly imported table, then export the resulting reports to Word format if possible.
Below is the code I am using:
***********************************************************
Function GET_EXPORT_DATA()
On Error GoTo GET_EXPORT_DATA_Err
CurrentDb.Execute "Delete * from [Export Scorecard]"
DoCmd.TransferSpreadsheet acImport, 8, "Export Scorecard", "T:\BIM\BPM\_ExportDB", True, ""
DoCmd.OpenQuery "CTE Query", acViewNormal, acEdit
DoCmd.OpenQuery "DayToPGI", acViewNormal, acEdit
GET_EXPORT_DATA_Exit:
Exit Function
GET_EXPORT_DATA_Err:
MsgBox Error$
Resume GET_EXPORT_DATA_Exit
End Function
******************************************************
The problem is that when I try to run it, I get the error message below:
'The Microsoft Jet Engine cannot open the file “”. It is opened exclusively by another user, or you need permission to view the file.'
Any assistance provided would be greatly appreciated. Thanks!