If you would like to add a dynamic barcode to InfoPath 2010 then you can download a barcode font and generate your value in whichever way you wish. Just remember that the value that you want to convert to a barcode must be surrounded by asterisks:
*123456789*
Otherwise some scanners wont pick it up.
You can find a free barcode font here: