Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Db window won't close

Status
Not open for further replies.

newguy86

Technical User
May 19, 2008
226
US
Here is the situation, I have a form in Access that opens another access db to transfer data over for storage. The issue is that once the macro is done with the 2nd db it closes the 2nd db but a generic blank "Microsoft Access" window is left behind. Even worse when I close the blank window it immediately reappears and I have to go into Task Manager to end the program. I have included my code in case someone can see something that I missed and any suggestions are greatly appreciated.

<Code>
Const strFilePath = "**************"
strDB = strFilePath & "TRAVEL AGENT.mdb"
Set appAccess = CreateObject("Access.Application")
Set accDB = appAccess.DBEngine.OpenDatabase(strDB, False, False, ";PWD=**********")
appAccess.OpenCurrentDatabase strDB
appAccess.Visible = True

strDocName = "TA Db Upload to Agency"
appAccess.DoCmd.OpenQuery strDocName

appAccess.CloseCurrentDatabase
appAccess.Quit

Set appAccess = Nothing
<\Code>

Travis
 
Well I figured it out, but something still doesn't seem right.

Why did it work when I moved:

<code>
Public strDocName as String
Public accDB as DAO.Database
<\code>

in the Option Compare Database area to the specific macro where they were being used and changed "Public" to "Dim". Shouldn't "Public" & "Dim" be responding the same way? One is used to create the same object for all macros and the other is used to create an object within a specific macro. Correct?

Travis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top