J
Jadabug
I have a form with a subform. On the subform, there are three
different bound txtboxes that will need to be changed if checkbox
"RevReq"=1. I would like to require these fields be dirty before
prompting a save. My code is listed below, and the problem could very
well be my ignorance of the "dirty" feature. Please advise...
Private Sub CloseRevReview_Click()
On Error GoTo Err_CloseRevReview_Click
If Me.RevReq = 1 Then
If Me.txtMC_Num.Dirty = False Or Me.txtRev_D.Dirty = False Or
Me.txtRev_Num.Dirty = False Then
MsgBox "Please ensure all fields are completed."
Me.txtMC_Num.BackColor = vbYellow
Me.txtRev_D.BackColor = vbYellow
Me.txtRev_Num.BackColor = vbYellow
Me.txtMC_Num.SetFocus
Me.ckClosureComplete.Value = False
End If
Exit Sub
ElseIf Me.ckRevReq = 2 Then
If IsNull(Me.memComments) Then
MsgBox "Please enter reasons no revision is necessary."
Me.memComments.BackColor = vbYellow
Me.memComments.SetFocus
Me.ckClosureComplete.Value = False
End If
Exit Sub
Else
Select Case MsgBox("Would you like to save the closeout of this
review?", _
vbYesNoCancel + vbQuestion, "Save Review?")
Case vbNo 'User does not want to save changes
Me.ckClosureComplete = False
Me.Undo
DoCmd.Close
DoCmd.OpenForm "Start Up"
Case vbCancel 'User Cancelled the action
Case Else 'Must have said "Yes"
'Save it
DoCmd.Close
DoCmd.OpenForm "Start Up"
End Select
End If
Exit_BttnClose_Click:
Exit Sub
DoCmd.Close
Exit_CloseRevReview_Click:
Exit Sub
Err_CloseRevReview_Click:
MsgBox Err.Description
Resume Exit_CloseRevReview_Click
End Sub
different bound txtboxes that will need to be changed if checkbox
"RevReq"=1. I would like to require these fields be dirty before
prompting a save. My code is listed below, and the problem could very
well be my ignorance of the "dirty" feature. Please advise...
Private Sub CloseRevReview_Click()
On Error GoTo Err_CloseRevReview_Click
If Me.RevReq = 1 Then
If Me.txtMC_Num.Dirty = False Or Me.txtRev_D.Dirty = False Or
Me.txtRev_Num.Dirty = False Then
MsgBox "Please ensure all fields are completed."
Me.txtMC_Num.BackColor = vbYellow
Me.txtRev_D.BackColor = vbYellow
Me.txtRev_Num.BackColor = vbYellow
Me.txtMC_Num.SetFocus
Me.ckClosureComplete.Value = False
End If
Exit Sub
ElseIf Me.ckRevReq = 2 Then
If IsNull(Me.memComments) Then
MsgBox "Please enter reasons no revision is necessary."
Me.memComments.BackColor = vbYellow
Me.memComments.SetFocus
Me.ckClosureComplete.Value = False
End If
Exit Sub
Else
Select Case MsgBox("Would you like to save the closeout of this
review?", _
vbYesNoCancel + vbQuestion, "Save Review?")
Case vbNo 'User does not want to save changes
Me.ckClosureComplete = False
Me.Undo
DoCmd.Close
DoCmd.OpenForm "Start Up"
Case vbCancel 'User Cancelled the action
Case Else 'Must have said "Yes"
'Save it
DoCmd.Close
DoCmd.OpenForm "Start Up"
End Select
End If
Exit_BttnClose_Click:
Exit Sub
DoCmd.Close
Exit_CloseRevReview_Click:
Exit Sub
Err_CloseRevReview_Click:
MsgBox Err.Description
Resume Exit_CloseRevReview_Click
End Sub