Debug error

  • Thread starter Dimitris Nikolakakis
  • Start date
D

Dimitris Nikolakakis

I have a form and in BeforeUpdate I have put the following:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.QuantityConfirmed > 0 And Me.EstimatedDeliveryDate Is Null Then
If MsgBox("my question", vbYesNo + vbQuestion) = vbNo Then
Cancel = True
Me.ActiveControl.Undo
End If
End If
End Sub

I input in QuantityConfirmed = 5 and I leave empty the EstimatedDeliveryDate
and I get debug error message:

Run-time error 424
Object Required

If I exclude the check in EstimatedDeliveryDate then it is OK.

Thanks in advance
Dimitris
 
K

Klatuu

It is just a syntax problem:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.QuantityConfirmed > 0 And IsNull(Me.EstimatedDeliveryDate) Then
If MsgBox("my question", vbYesNo + vbQuestion) = vbNo Then
Cancel = True
Me.ActiveControl.Undo
End If
End If
End Sub
 
C

Chris L via AccessMonster.com

Try the isnull function:-

If Me.QuantityConfirmed > 0 And isnull(Me.EstimatedDeliveryDate) Then

hth
Chris
 
Top