Yes, this should be possible. Can we assume that you are normally in the
process of adding a new record, when you perform the scan? Without knowing
the structure of your application, here is an outline of an approach:
1. You could use a DCount or DLookup statement in the BeforeUpdate event
procedure for the UPC textbox. DCount would probably be easier, since you
will get 0 returned if no other records exist, whereas with DLookup you would
need to deal with a null. The domain aggregrate function would include the
scanned UPC as a criteria.
DLookup Usage Samples
http://www.mvps.org/access/general/gen0018.htm
Although I'm not a big fan using macros, you might want to practice setting
up a Domain Aggregrate function with this example for Northwind:
How to Check for Duplicate Values in Primary Key Fields
http://support.microsoft.com/kb/209487
You can always convert a macro to VBA code afterwards. So, basically, you
would cancle the event, as shown in this macro, but you would also issue an
update query in VBA code to increment the quantity field by one.
Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________