NeedHelp
August 23rd, 1999, 03:43 PM
I am creating as Access Application from VB and then am running a macro stored in Access. When I am done running the macro I want to close the Access application that I created and return to the VB code. This is working except the databse I open closes but Access remains open. The only way I can close Access is going into Task Manager and end process. I cant even close Access by hitting the close button. Is there a way to close this? The following is the code that I am currently using. I thought when I set the oAccess = nothing this would close Acccess out of memory??
Dim oAccess As Access.Application
Start = Timer
Do While Timer < Start + 30
DoEvents
Loop
Set oAccess = CreateObject("Access.Application")
oAccess.OpenCurrentDatabase ("E:\Database.mdb")
DoEvents
oAccess.DoCmd.RunMacro "Run Macro"
DoEvents
oAccess.CloseCurrentDatabase
DoEvents
Set oAccess = Nothing
Dim oAccess As Access.Application
Start = Timer
Do While Timer < Start + 30
DoEvents
Loop
Set oAccess = CreateObject("Access.Application")
oAccess.OpenCurrentDatabase ("E:\Database.mdb")
DoEvents
oAccess.DoCmd.RunMacro "Run Macro"
DoEvents
oAccess.CloseCurrentDatabase
DoEvents
Set oAccess = Nothing