NewTexican
Technical User
Something tells me their might be a way to write this snippet of code better.
'closes all forms that can be opened from this one
Private Sub Command57_Click()
On Error GoTo Err_Command57_Click
Dim stDocName As String
Dim stdocname2 As String
Dim stdocname3 As String
Dim stdocname4 As String
Dim stdocname5 As String
Dim stdocname6 As String
stDocName = "Call Note F"
stdocname2 = "call note sf"
stdocname3 = "Company Mailout F"
stdocname4 = "Person popup from common f"
stdocname5 = "Person-complist f"
stdocname6 = "person address f"
DoCmd.Close acForm, stDocName
DoCmd.Close acForm, stdocname2
DoCmd.Close acForm, stdocname3
DoCmd.Close acForm, stdocname4
DoCmd.Close acForm, stdocname5
DoCmd.Close acForm, stdocname6
DoCmd.Close
Exit_Command57_Click:
Exit Sub
Err_Command57_Click:
MsgBox Err.Description
Resume Exit_Command57_Click
End Sub
What would you do?
'closes all forms that can be opened from this one
Private Sub Command57_Click()
On Error GoTo Err_Command57_Click
Dim stDocName As String
Dim stdocname2 As String
Dim stdocname3 As String
Dim stdocname4 As String
Dim stdocname5 As String
Dim stdocname6 As String
stDocName = "Call Note F"
stdocname2 = "call note sf"
stdocname3 = "Company Mailout F"
stdocname4 = "Person popup from common f"
stdocname5 = "Person-complist f"
stdocname6 = "person address f"
DoCmd.Close acForm, stDocName
DoCmd.Close acForm, stdocname2
DoCmd.Close acForm, stdocname3
DoCmd.Close acForm, stdocname4
DoCmd.Close acForm, stdocname5
DoCmd.Close acForm, stdocname6
DoCmd.Close
Exit_Command57_Click:
Exit Sub
Err_Command57_Click:
MsgBox Err.Description
Resume Exit_Command57_Click
End Sub
What would you do?