Cant Close Form and Open Another Form?

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

This code does not close the form BlankChecks, Why?

Private Sub Label146_Click()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "BlankChecksnotposted"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "BlankChecks"

End Sub
 
Dave Elliott said:
This code does not close the form BlankChecks, Why?

Private Sub Label146_Click()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "BlankChecksnotposted"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "BlankChecks"

End Sub

I see nothing wrong with the code.

Do you get an error or does the form simply not close?
 
Had to add DoCmd.Close acForm, "BlankChecks"
to the form that opened for this to work?
Thanks,
 
Dave Elliott said:
Had to add DoCmd.Close acForm, "BlankChecks"
to the form that opened for this to work?
Thanks,


That's what I would expect if you were opening the second form with the acDialog
option, but without that your original code should work.
 
Dave

Try



'close the current form
docmd.close

then open your new form as per your coding
 
Back
Top