P
Penstar
I have the following code, which returns an error Runtime Error 2464 Data
Type Mismatch in Criteria expression
Private Sub Form_Delete(Cancel As Integer)
Dim varDeliveryID As Variant
Dim strType As Variant, strWhere As Variant
strType = Me.DeliveryID
strWhere = "[DeliveryID]=""" & strType & """"
If IsNull(DLookup("DeliveryID", "dbrders", strWhere)) Then
Response = acDataErrContinue
Cancel = False
Else
MsgBox "The Delivery Customer contains orders. It cannot be deleted"
Cancel = True
End If
End Sub
All DeliveryID fields are set up as "Int" fields. I have tried putting
declarations as integer, but doesn't seem to help.
Thanks
Penny
Type Mismatch in Criteria expression
Private Sub Form_Delete(Cancel As Integer)
Dim varDeliveryID As Variant
Dim strType As Variant, strWhere As Variant
strType = Me.DeliveryID
strWhere = "[DeliveryID]=""" & strType & """"
If IsNull(DLookup("DeliveryID", "dbrders", strWhere)) Then
Response = acDataErrContinue
Cancel = False
Else
MsgBox "The Delivery Customer contains orders. It cannot be deleted"
Cancel = True
End If
End Sub
All DeliveryID fields are set up as "Int" fields. I have tried putting
declarations as integer, but doesn't seem to help.
Thanks
Penny