Private Sub Form_Unload(Cancel As Integer)
On Error GoTo MY_ERROR
Dim ctl As Control
For Each ctl In Me.Controls
If Me.yourdropdownname.Value = "61PM-Promised to pay" Then
If ctl.ControlType = acTextBox Then
Select Case ctl.Name
Case "PROMISE_DATE", "PROMISE_AMOUNT", "DUE_DATE"
If IsNull(ctl) Then
MsgBox ctl.Name & " is a required field, " & vbCr & _
"Please enter the required information to continue.", _
vbInformation, "Required Field"
' ctl.BackColor = 13303807 'Light Yellow
' Make sure you set the lost focus event
' for each textbox to set them back to default.
' me.backcolor = vbwhite 'or 16777215
ctl.SetFocus
Cancel = True
Exit Sub
End If
End Select
End If
End If
Next ctl
Exit Sub
MY_ERROR:
MsgBox Err.Number & vbCr & vbCr & Err.Description
End Sub