VBA question

  • Thread starter Thread starter Junior
  • Start date Start date
J

Junior

I'm testing the relationship of two dates in the before update event in the
control [cboAppPos] that follows the date entrys. how can i stop the user
from proceeding until the date relationship is correct?

Private Sub cboAppPos_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_HandleErr_Click
Dim dtRec, dtApdte As Date
dtRec = Nz(Me!txtDteRecvd, 99)
dtApdte = Nz(Me!txtDteApp, 99)

If dtRec = 99 Or dtRec = "" Then
MsgBox "Date application received is missing." _
& vbCrLf & "Enter the date received.", , "Date received missing"

ElseIf Not IsNull(dtRec) And dtApdte > dtRec Then
MsgBox "The application date must be earlier than the date received." _
& vbCrLf & "Please enter the correct date received.", , "Date received
error"
Me!txtDteRecvd = Null

End If
 
Back
Top