Validation Code Error

M

MKuria

I am running the code below to validate 2 fields entered in a form and if
they fall oustide the given dates - user has to complete the concerns field.
If is not working.
Help
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.[District_Issues_Concerns]) And
Me.[Scheduled_Date_Supply_Delivery] < Me.[Phase_Start_Date] Or
Me.[Scheduled_Date_Supply_Delivery] > Me.[Phase_Completion_Date] Then MsgBox
"Date entered - Explain", vbOKOnly
Me.[District_Issues_Concerns].SetFocus
Cancel = True


Else IsNull(Me.District_Issues_Concerns) And
Me.Scheduled_Date_Box_Destruction < Me.Phase_Start_Date Or
Me.[Scheduled_Date_Box_Destruction] > Me.Phase_Completion_Date Then MsgBox
"Date entered - Explain", vbOKOnly
Me![District_Issues_Concerns].SetFocus
Cancel = True

End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top