What i want to do is make sure that a record has a certain field completed before closing, but i cant really do it by setting it as required because i have multiple me.refresh in it. So I did this
Private Sub Form_Unload(Can cel As Integer)
If IsNull([Combo24]) Then
If MsgBox("The inspector box has to be filled in, or the record will be deleted. Do you want to continue closing and delete the record?", vbYesNo) = vbNo Then
Cancel = True
Combo60.SetFocu s
Me.Refresh
Else
DoCmd.SetWarnin gs False
DoCmd.RunComman d acCmdSelectReco rd
DoCmd.RunComman d acCmdDeleteReco rd
End If
End If
Else
Exit Sub
End Sub
The problem with this is..... If i just open the form to look at it, and then close the form it prompts me to see if I want to delete the record, but there is no record to delete so I get an error stating that i need to debug, yada yada yada.
Private Sub Form_Unload(Can cel As Integer)
If IsNull([Combo24]) Then
If MsgBox("The inspector box has to be filled in, or the record will be deleted. Do you want to continue closing and delete the record?", vbYesNo) = vbNo Then
Cancel = True
Combo60.SetFocu s
Me.Refresh
Else
DoCmd.SetWarnin gs False
DoCmd.RunComman d acCmdSelectReco rd
DoCmd.RunComman d acCmdDeleteReco rd
End If
End If
Else
Exit Sub
End Sub
The problem with this is..... If i just open the form to look at it, and then close the form it prompts me to see if I want to delete the record, but there is no record to delete so I get an error stating that i need to debug, yada yada yada.
Comment