Private sub Productname_Beforeupdate(cancel as integer)
if (not isnull(dlookup("[Productname]","roducts","[productname]='" _
& me!productname & "'") )) then
msgbox"roduct has already been entered in the database"
cancel=true
me!productname.undo
endif
endsub