H
How1
Can someone give me code for checking if a record exists then prompt the user
to let them know that the record exists.
Here is code that I have came up with myself. However it is not doing what I
need it to do.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim Flag As Integer
Flag = 0
If Me.MK_NO_ <> Me.MK_NO_.OldValue Then
Flag = Flag + 1
ElseIf Me.COMP_TYPE <> Me.COMP_TYPE.OldValue Then
Flag = Flag + 1
ElseIf Me.ROTOR_SIZE <> Me.ROTOR_SIZE.OldValue Then
Flag = Flag + 1
ElseIf Me.L_D <> Me.L_D.OldValue Then
Flag = Flag + 1
ElseIf Me.BIPR <> Me.BIPR.OldValue Then
Flag = Flag + 1
ElseIf Me.SER_NO_ <> Me.SER_NO_.OldValue Then
Flag = Flag + 1
ElseIf Me.SYSTEM_NO_ <> Me.SYSTEM_NO_.OldValue Then
Flag = Flag + 1
ElseIf Me.PART_NO <> Me.PART_NO.OldValue Then
Flag = Flag + 1
ElseIf Me.ORDER_PREF <> Me.ORDER_PREF.OldValue Then
Flag = Flag + 1
ElseIf Me.ORDER_NO_ <> Me.ORDER_NO_.OldValue Then
Flag = Flag + 1
ElseIf Me.ORIG_CONT_ <> Me.ORIG_CONT_.OldValue Then
Flag = Flag + 1
ElseIf Me.UNIT_NO_ <> Me.UNIT_NO_.OldValue Then
Flag = Flag + 1
ElseIf Me.DATE_SHIP_ <> Me.DATE_SHIP_.OldValue Then
Flag = Flag + 1
ElseIf Me.DATE_DUE <> Me.DATE_DUE.OldValue Then
Flag = Flag + 1
ElseIf Me.BOOKED <> Me.BOOKED.OldValue Then
Flag = Flag + 1
ElseIf Me.CLIENTS_OR <> Me.CLIENTS_OR.OldValue Then
Flag = Flag + 1
ElseIf Me.DATE_ISS_D <> Me.DATE_ISS_D.OldValue Then
Flag = Flag + 1
ElseIf Me.GAS_HANDLE <> Me.GAS_HANDLE.OldValue Then
Flag = Flag + 1
ElseIf Me.CUSTOMER <> Me.CUSTOMER.OldValue Then
Flag = Flag + 1
ElseIf Me.COUNTRY <> Me.COUNTRY.OldValue Then
Flag = Flag + 1
ElseIf Me.SITE <> Me.SITE.OldValue Then
Flag = Flag + 1
ElseIf Me.USER <> Me.USER.OldValue Then
Flag = Flag + 1
ElseIf Me.NOTE <> Me.NOTE.OldValue Then
Flag = Flag + 1
ElseIf Me.OTHER_SPEC <> Me.OTHER_SPEC.OldValue Then
Flag = Flag + 1
ElseIf Me.O_RING_MAT <> Me.O_RING_MAT.OldValue Then
Flag = Flag + 1
ElseIf Me.CASING_MAT <> Me.CASING_MAT.OldValue Then
Flag = Flag + 1
ElseIf Me.SEAL_TYPE <> Me.SEAL_TYPE.OldValue Then
Flag = Flag + 1
ElseIf Me.PAINT_SPEC <> Me.PAINT_SPEC.OldValue Then
Flag = Flag + 1
ElseIf Me.EVAP_TEMP <> Me.EVAP_TEMP.OldValue Then
Flag = Flag + 1
ElseIf Me.COND_TEMP <> Me.COND_TEMP.OldValue Then
Flag = Flag + 1
If Flag > 0 Then resp = MsgBox("record already exists")
End If
Thanks.
to let them know that the record exists.
Here is code that I have came up with myself. However it is not doing what I
need it to do.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim Flag As Integer
Flag = 0
If Me.MK_NO_ <> Me.MK_NO_.OldValue Then
Flag = Flag + 1
ElseIf Me.COMP_TYPE <> Me.COMP_TYPE.OldValue Then
Flag = Flag + 1
ElseIf Me.ROTOR_SIZE <> Me.ROTOR_SIZE.OldValue Then
Flag = Flag + 1
ElseIf Me.L_D <> Me.L_D.OldValue Then
Flag = Flag + 1
ElseIf Me.BIPR <> Me.BIPR.OldValue Then
Flag = Flag + 1
ElseIf Me.SER_NO_ <> Me.SER_NO_.OldValue Then
Flag = Flag + 1
ElseIf Me.SYSTEM_NO_ <> Me.SYSTEM_NO_.OldValue Then
Flag = Flag + 1
ElseIf Me.PART_NO <> Me.PART_NO.OldValue Then
Flag = Flag + 1
ElseIf Me.ORDER_PREF <> Me.ORDER_PREF.OldValue Then
Flag = Flag + 1
ElseIf Me.ORDER_NO_ <> Me.ORDER_NO_.OldValue Then
Flag = Flag + 1
ElseIf Me.ORIG_CONT_ <> Me.ORIG_CONT_.OldValue Then
Flag = Flag + 1
ElseIf Me.UNIT_NO_ <> Me.UNIT_NO_.OldValue Then
Flag = Flag + 1
ElseIf Me.DATE_SHIP_ <> Me.DATE_SHIP_.OldValue Then
Flag = Flag + 1
ElseIf Me.DATE_DUE <> Me.DATE_DUE.OldValue Then
Flag = Flag + 1
ElseIf Me.BOOKED <> Me.BOOKED.OldValue Then
Flag = Flag + 1
ElseIf Me.CLIENTS_OR <> Me.CLIENTS_OR.OldValue Then
Flag = Flag + 1
ElseIf Me.DATE_ISS_D <> Me.DATE_ISS_D.OldValue Then
Flag = Flag + 1
ElseIf Me.GAS_HANDLE <> Me.GAS_HANDLE.OldValue Then
Flag = Flag + 1
ElseIf Me.CUSTOMER <> Me.CUSTOMER.OldValue Then
Flag = Flag + 1
ElseIf Me.COUNTRY <> Me.COUNTRY.OldValue Then
Flag = Flag + 1
ElseIf Me.SITE <> Me.SITE.OldValue Then
Flag = Flag + 1
ElseIf Me.USER <> Me.USER.OldValue Then
Flag = Flag + 1
ElseIf Me.NOTE <> Me.NOTE.OldValue Then
Flag = Flag + 1
ElseIf Me.OTHER_SPEC <> Me.OTHER_SPEC.OldValue Then
Flag = Flag + 1
ElseIf Me.O_RING_MAT <> Me.O_RING_MAT.OldValue Then
Flag = Flag + 1
ElseIf Me.CASING_MAT <> Me.CASING_MAT.OldValue Then
Flag = Flag + 1
ElseIf Me.SEAL_TYPE <> Me.SEAL_TYPE.OldValue Then
Flag = Flag + 1
ElseIf Me.PAINT_SPEC <> Me.PAINT_SPEC.OldValue Then
Flag = Flag + 1
ElseIf Me.EVAP_TEMP <> Me.EVAP_TEMP.OldValue Then
Flag = Flag + 1
ElseIf Me.COND_TEMP <> Me.COND_TEMP.OldValue Then
Flag = Flag + 1
If Flag > 0 Then resp = MsgBox("record already exists")
End If
Thanks.