-
Access keeps opening up and not closing despite the code I have. Is there anything that i'm missing?
[vba]Public Sub runQueryFromDB(query As String, myRS As DAO.Recordset)
'Add the reference to Microsoft Access 11.0 Lib.
'Add the DAO 3.6 reference
Dim myAccess As access.Application
Dim myDB As Database
Set myAccess = CreateObject("Access.Application")
'myAccess.Application.Visible = False 'if you don't run this the database will run in the background hidden
myAccess.OpenCurrentDatabase ("C:\Documents and Settings\IntTesting\IA Testing.mdb")
'open access query normally
myAccess.DoCmd.OpenQuery (query)
'create recordset
Set myDB = myAccess.CurrentDb()
Set myRS = myDB.OpenRecordset(query)
myAccess.Application.Quit
Set myAccess = Nothing
End Sub[/vba]
When I delete the sheet where the tables were loaded, then access will close.
Last edited by taporctv; 07-16-2007 at 06:00 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules