Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello All, I have a button on 1

Status
Not open for further replies.

achiola

MIS
Apr 26, 2001
44
US
Hello All,
I have a button on a form, the code for it is below. When I click on the button it opens another form, however, I want the form with the button to close when I do this. What do I add to the code below to allow it to do this?

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Accounts Payable Switchboard"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub

Thanks,
Nino
 
This should work:

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Accounts Payable Switchboard"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmYourForm", acSaveYes
Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top