E
Emiliano
Hello,
I am using the OpenCurrentDatabase method with the following code:
Sub Pref(seeit As Boolean, openit As Boolean)
Dim PrefPath As String
'Path of pref.mdb
PrefPath = ThisWorkbook.Path & "\pref.mdb"
'Open Access and make it visible when seeit=true
Set oApp = CreateObject("Access.Application")
oApp.Visible = seeit
'open pref.mdb
oApp.OpenCurrentDatabase PrefPath
'open the following query
oApp.DoCmd.OpenQuery "qAppendFax"
oApp.DoCmd.OpenQuery "qDeleteFax"
oApp.DoCmd.OpenQuery "qAppendTeor"
oApp.DoCmd.OpenQuery "qdeleteTeor"
'open the fax form if openit=true
If openit Then
oApp.DoCmd.OpenForm "fax"
End If
'closes db
oApp.CloseCurrentDatabase
Set oApp = Nothing
End Sub
the boolean argument seeit allows to show or to hide the Access window
while openit allows to skip the opening of the "fax" form.
My issue is that when the two arguments are both set on true Access
don't stays open on the form but closes immediately. This event don't
happen if the two statements
oApp.CloseCurrentDatabase
Set oApp = Nothing
are omitted.
Are these two statements necessary, or I get the same result closing
the Access window manually?
Moreover is it possible to get the Access window open maximized?
Emiliano
I am using the OpenCurrentDatabase method with the following code:
Sub Pref(seeit As Boolean, openit As Boolean)
Dim PrefPath As String
'Path of pref.mdb
PrefPath = ThisWorkbook.Path & "\pref.mdb"
'Open Access and make it visible when seeit=true
Set oApp = CreateObject("Access.Application")
oApp.Visible = seeit
'open pref.mdb
oApp.OpenCurrentDatabase PrefPath
'open the following query
oApp.DoCmd.OpenQuery "qAppendFax"
oApp.DoCmd.OpenQuery "qDeleteFax"
oApp.DoCmd.OpenQuery "qAppendTeor"
oApp.DoCmd.OpenQuery "qdeleteTeor"
'open the fax form if openit=true
If openit Then
oApp.DoCmd.OpenForm "fax"
End If
'closes db
oApp.CloseCurrentDatabase
Set oApp = Nothing
End Sub
the boolean argument seeit allows to show or to hide the Access window
while openit allows to skip the opening of the "fax" form.
My issue is that when the two arguments are both set on true Access
don't stays open on the form but closes immediately. This event don't
happen if the two statements
oApp.CloseCurrentDatabase
Set oApp = Nothing
are omitted.
Are these two statements necessary, or I get the same result closing
the Access window manually?
Moreover is it possible to get the Access window open maximized?
Emiliano