I have an Excel workbook that is linked to an Access query and I want to be able to refresh the workbook an Access module.
If I open the Excel spreadsheet and run a macro that uses ActiveWorkbook.Refreshall the data is refreshed OK without error.
In my Access module I have set up a reference to Excel using Getobject("myWorkbook")as myXL and my code opens and makes visible the spreadsheet OK but myXL.ActiveWorkbook.Refreshall produces an error box titled "ODBC Microsoft Access Driver Login Failed" The database has been placed in a state by user xxx that prevents it from being opened or locked.
Since opening the spreadsheet manually and refreshing the data works without a prompt to login to the Access database I don't understand why such an error is poduced when I am replicating the same code in Access.
Any help appreciated.
Mike C
If I open the Excel spreadsheet and run a macro that uses ActiveWorkbook.Refreshall the data is refreshed OK without error.
In my Access module I have set up a reference to Excel using Getobject("myWorkbook")as myXL and my code opens and makes visible the spreadsheet OK but myXL.ActiveWorkbook.Refreshall produces an error box titled "ODBC Microsoft Access Driver Login Failed" The database has been placed in a state by user xxx that prevents it from being opened or locked.
Since opening the spreadsheet manually and refreshing the data works without a prompt to login to the Access database I don't understand why such an error is poduced when I am replicating the same code in Access.
Any help appreciated.
Mike C