B
Brad
Thanks for taking the time to read my question.
I have a set of criteria that if met during the Before
Update event of a form, should tell the user that the
record could not be written because it would create a
duplicate record.
I can do that part, but how do I stop Access from writing
to the table? Some sort of cancel event or something?
I already have a key on the table that includes the date
on the form, as well as a few prices, also on the form.
If any one of these are changed the record can be
written, if all fields but the date are changed, the key
will allow the record to be written, but the date has to
change, and there inlies my problem. If the user changes
only one price but not the date, it will create two
prices on the same day, and I don't want that to happen.
Thanks again for your help,
Brad
What I have so far...
---------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim Exists As Boolean
Exists = DLookup
("PricingIngredTextCode", "qryCheckIfCurrentIngredEffectiv
eDateAlreadyExists")
If Exists = True Then
Cancel 'I need something here to stop Access from
writing to the source table.
End If
End Sub
I have a set of criteria that if met during the Before
Update event of a form, should tell the user that the
record could not be written because it would create a
duplicate record.
I can do that part, but how do I stop Access from writing
to the table? Some sort of cancel event or something?
I already have a key on the table that includes the date
on the form, as well as a few prices, also on the form.
If any one of these are changed the record can be
written, if all fields but the date are changed, the key
will allow the record to be written, but the date has to
change, and there inlies my problem. If the user changes
only one price but not the date, it will create two
prices on the same day, and I don't want that to happen.
Thanks again for your help,
Brad
What I have so far...
---------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim Exists As Boolean
Exists = DLookup
("PricingIngredTextCode", "qryCheckIfCurrentIngredEffectiv
eDateAlreadyExists")
If Exists = True Then
Cancel 'I need something here to stop Access from
writing to the source table.
End If
End Sub