If Err.Number = 0 Or Err.Number = 2501 Then Err.Clear End If On Error Resume Next If IsNull(Me.ComboBox) Then MsgBox "No Item Was Selected." & vbCrLf & "Please select an item from the pull-down menu before proceeding.", vbExclamation + vbOKOnly, "Select Item" End If If (Form.Dirty Or Not Me.subForm.Form.NewRecord) Then 'if I use Me.subForm.Form.Dirty the undo doesn't work on the subform If MsgBox("This record has been changed. Do you want to save changes?", vbQuestion + vbYesNo, "Save Changes?") = vbNo Then DoCmd.RunCommand acCmdUndo 'to undo changes on the main form Me.subIMenuCondition.SetFocus DoCmd.SetWarnings False 'hides the do you want to delete this record message DoCmd.RunCommand acCmdUndo 'to undo changes on the subform Else DoCmd.RunCommand acCmdSaveRecord DoCmd.OpenForm "FRM_NewForm", acNormal End If Else DoCmd.OpenForm "FRM_NewForm", acNormal End If DoCmd.SetWarnings True
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.