You may find this thread on bar code scanning useful: Need help writing script to integrate barcode scanning
If you scan the barcode into a global field, you can use that field as a match field in a relationship to check for the existance of a record with that barcode.
LayoutTableOccurrence::GlobalBarCodeField = Inventorytable::BarCodeField
then, in a scirpt:
If [ IsEmpty ( InventoryTable::BarcodeField ) ]
will be true if there is no existing record with that barcode and your script can then create a new record.