View Full Version : beforeupdate to validate record


atomic
07-16-2001, 06:23 AM
hi all,

i am having a little trouble with checking if a record has been entered into the database before it is added. (duplicate records - user is prompted wether they wish to add a new order on the same date to the same supplier!!)

the problem is that the event is triggered after every button control click and i only need it to work if the user clicks the Save button or click the NewRecord button that comes with the form.

is there another way i can check to see if a record has been entered??

thanx in advance,
andy

D-Fresh
07-16-2001, 06:33 AM
Check Charity's answer from the following post... Should work for you if you throw it in the before update event of your primary key...

http://www.access-programmers.co.uk/ubb/Forum4/HTML/003621.html

atomic
07-16-2001, 06:49 AM
hi dfresh

i am not checking for duplicate values in the primary key. i am looking for a condition to be met.

if orderdate and companyname exists then
prompt user to save
if user wants to save then
add record
else
do not add record
end if
end if

there is more than one field involved. if i add this into the FORM_BeforeUpdate procedure, everytime i click a Command Button (i have a print preview button and get customer detailsbutton), it goes thru the above procedure. i only need it when i attempt to save a record or move to a new record.

does this make sense?

cheers
a http://www.access-programmers.co.uk/ubb/smile.gif