VBA question

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
 

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