Closing Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
hi,
don't use the me command instead use

DoCmd.Close acForm, "NameOfFormToClose", acNormal

regards

FSt1
 
Add the statement

DoCmd.Close acForm, Me.Name, acSaveNo

after your OpenForm statement.
 
Back
Top