![]() |
Imports
I am creating a macro to transfer information from Excel to Access. Every other time I run it I get an error stating that "You cannot carry out the action at the present time". I have a feeling that Access is not closing properly after I run it the first time. Why am I getting this error? How do I fix this? Also -- how can I get the Access window to close -- the database closes just not the window? Below is my code. Thank You Dim dba As Access.Application Dim stgPath As String Set dba = CreateObject("access.application") stgPath = ("C:\fink\sta.mdb") dba.OpenCurrentDatabase filepath:=stgPath DoCmd.SetWarnings False DoCmd.OpenQuery "Delete UnlCdL", , acEdit DoCmd.TransferSpreadsheet acImport, , _ "CD LSTN", ThisWorkbook.FullName, True, "Pcday" DoCmd.SetWarnings True dba.CloseCurrentDatabase |
All times are GMT +1. The time now is 01:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com