Closing Form

B

Brennan

Hello:
I have the following code attached to a command button on a form

Private Sub cmdOpenQAWO_Click()
On Error GoTo Err_cmdOpenQAWO_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmWarrantyWO"

stLinkCriteria = "[WONum]=" & Me![List12]
DoCmd.OpenForm stDocName, , , stLinkCriteria


Exit_cmdOpenQAWO_Click:
Exit Sub

Err_cmdOpenQAWO_Click:
MsgBox Err.Description
Resume Exit_cmdOpenQAWO_Click


As a last step, I want to close the form that this button is on. I tried
adding me.close after the last DoCmd but it closes the form that I am
opening, not the form that I am on.

Any help would be appreciated.

Thanks
Brennan
 
F

FSt1

hi,
don't use the me command instead use

DoCmd.Close acForm, "NameOfFormToClose", acNormal

regards

FSt1
 
V

Van T. Dinh

Add the statement

DoCmd.Close acForm, Me.Name, acSaveNo

after your OpenForm statement.
 
Top