This example closes a form if it is open or does nothing.
' ****************** Code Start ********************* ' Example by Terry Wickenden Sub CloseOpenForm (strName as String) On Error Goto ErrClose DoCmd.SelectObject acForm, strName, False DoCmd.RunCommand acCmdClose Exit Sub ErrClose: Select Case Err Case 2489 'Form Not Open Case Else MsgBox Err & :-" & vbCrLf & Err.Desciption End Select End Sub ' **************** Code End ******************