It really depends on exactly what you're trying to do. There are a couple of approaches you could take:
1) If the values you want to input exist in another table that has the bar code in it (such as a product catalog), you could use it as a key field and then execute a lookup into the current table (perhaps a line item on an invoice?).
2) If, on the other hand, you're trying to execute some business logic based on the bar code entry, you can use an OnObjectModify Script Trigger to execute a script when the bar code is entered.
More detail on your exact problem will likely result in a more precise answer.
Question: Do you mean filling out fields in a table with record data from another table based on the scanned barcode, like a lookup?
Personally I wouldn't use as a key field because the barcode possibly could change in the future if it is not your own barcode ( meaning that you don't have full control of what the barcode is and if it stays the same ).
Personally I would create a field where the barcode can be scanned in and write some logic ( script ) after the field is exited using a script trigger. This gives you more control over what happens after the scan takes place. I've configured my scanner to pass an ENTER or RETURN after scanning. When "go to next tab using RETURN or ENTER" is on the data properties is set, the trigger will fire.
Actually, on further reflection, OnObjectModify is a bad trigger to use; each character that comes across will fire the trigger.
If you're using a typical external scanner, electon's trailing return trick will work a treat. (We've done that for years.) If, on the other hand, you're using the built-in camera, you won't need a trigger at all; just use the Insert From Device script step in the middle of a script and it will capture the bar code and proceed on from there.