I am trying to open a form in Access which is a pivot table. I have read where the acDialog property should keep the form open but no matter what I do it just flashes and closes. I have inserted a STOP after the OpenForm and it is indeed being generated correctly it just gets closed without the STOP there. Any ideas? I am running the code from MS Project. Any ideas are appreciated.
Here is the code:
Sub TestOpenForm()
Dim strFormName As String
Dim strDBName As String
strFormName = "QueryNoStart"
strDBName = "C:\Documents and Settings\jeffb.HAC\My
Documents\project3.mdb"
On Error GoTo TestOpenform_Err
' Create Automation object.
Dim objAccess As Object
Set objAccess = CreateObject("Access.Application")
' Open the database.
objAccess.OpenCurrentDatabase strDBName, False
objAccess.DoCmd.OpenForm strFormName, acFormPivotTable, , , ,
acDialog
' Close Microsoft Access session instance...
objAccess.Quit acExit
Set objAccess = Nothing
Exit Sub
TestOpenform_Err:
MsgBox Error$(), vbInformation, "Automation"
End Sub
Here is the code:
Sub TestOpenForm()
Dim strFormName As String
Dim strDBName As String
strFormName = "QueryNoStart"
strDBName = "C:\Documents and Settings\jeffb.HAC\My
Documents\project3.mdb"
On Error GoTo TestOpenform_Err
' Create Automation object.
Dim objAccess As Object
Set objAccess = CreateObject("Access.Application")
' Open the database.
objAccess.OpenCurrentDatabase strDBName, False
objAccess.DoCmd.OpenForm strFormName, acFormPivotTable, , , ,
acDialog
' Close Microsoft Access session instance...
objAccess.Quit acExit
Set objAccess = Nothing
Exit Sub
TestOpenform_Err:
MsgBox Error$(), vbInformation, "Automation"
End Sub