G
Guest
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
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