I have two databased files. CurrentDb and HistoryDB in MS Access 2003.
From a form in HistoryDB on command button click event I need next:
I want to open two bound forms in CurrentDB with particular record in
then I want to close HistoryDB and have CurrentDB form frmMainEdit stay opened and frmMainOutstand should be hidden.
I started with some code as bellow but can not figure out how to close HistoryDB at the end of procedure and have CurrentDB open.
********************************************
Private Sub CmdOpen_Form_In_CurrentDatabase_Click()
Dim strDB As String
strDB = "D:\Databases\CurrentdB.mdb"
Dim appAccess As Access.Application
Set appAccess = New Access.Application
Dim strFilter1 as string
strFilter1 = "Some text xxxxxx"
appAccess.OpenCurrentDatabase strDB
appAccess.Visible = True
appAccess.UserControl = True
stDocName = "frmMainOutStand"
appAccess.DoCmd.OpenForm stDocName
Forms!frmMainOutstand!sfrmMainOutStandCurr.Form.Filter = strFilter1
Forms!frmMainOutstand!sfrmMainOutStandCurr.Form.FilterOn = True
Forms!frmMainOutstand!sfrmMainOutStandHis.Form.Filter = strFilter1
Forms!frmMainOutstand!sfrmMainOutStandHis.Form.FilterOn = True
stDocName = "frmMainEdit"
appAccess.DoCmd.OpenForm stDocName
Forms!frmMainEdit.Form.Filter = strFilter1
Forms!frmMainEdit.Form.FilterOn = True
End Sub