Cant Close Form and Open Another Form?

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
 
R

Rick Brandt

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?
 
D

Dave Elliott

Had to add DoCmd.Close acForm, "BlankChecks"
to the form that opened for this to work?
Thanks,
 
R

Rick Brandt

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.
 
A

Allan Murphy

Dave

Try



'close the current form
docmd.close

then open your new form as per your coding
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top