PDA

View Full Version : Hiding Access Screen



taporctv
03-21-2008, 06:58 AM
I'm having a little trouble with an Access object I created within excel. Here's the code:

Dim myAccess As access.Application
Dim myDB As Database
Set myAccess = CreateObject("Access.Application")

' Relative path
Dim CurDir As String
CurDir = ThisWorkbook.Path & "\IA Testing.mdb"

' myAccess.Application.Visible = False 'if you don't run this the database will run in the background hidden
myAccess.OpenCurrentDatabase (CurDir)

' open access query normally
myAccess.Visible = False
myAccess.DoCmd.OpenQuery (query)
Application.DisplayAlerts = False

If NoMyRs = False Then
' create recordset
Set myDB = myAccess.CurrentDb()
Set myRS = myDB.OpenRecordset(query)
End If



myAccess.Quit
Set myAccess = Nothing

Everything if fine until I run myAccess.quit. After this line of code is executed, an Access window pops up. How do I prevent this? May I be overlooking something?

akn112
03-24-2008, 07:18 AM
to prvent access popups use myaccess.docmd.setwarnings false

Carl A
03-24-2008, 12:25 PM
Might Try This:

If NoMyRs = False Then
' create recordset
Set myDB = myAccess.CurrentDb()
Set myRS = myDB.OpenRecordset(query)
End If

myDB.Close
myRS.Close
Set myDB = Nothing
Set MyRS = Nothing

myAccess.Quit
Set myAccess = Nothing

Trevor
03-29-2008, 11:28 PM
I agree with AKN112