Close Form

  • Thread starter Thread starter Bernd Smits
  • Start date Start date
B

Bernd Smits

Hi,
I would like to automaticly close a form when another is open.
Exactly I've made a combobox that permise me to research a name and
double-click on the selected name another form (with personal data) is open,
and that moment I would like that the first (the research form) close.
Anyone can help me?
Thanks
Bernd
 
Bernd, If you're using criteria on the first form that is needed simply hide the form like so

Private Sub Command1_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Form2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Me.Visible = False
'if you want to close it do this
'DoCmd.Close acForm, "Form1"

End Sub

Then on the Close event of form2 you can either close Form1 or make it visible

Private Sub Form_Close()
Forms!Form1.Form.Visible = True

'or to close it
'DoCmd.Close acForm, "Form1"

End Sub
 
Back
Top