Closing Form

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
 
G

Guest

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.
 

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