I am sure I saw another issue along the similar lines in one of the FAQ topics, have a look there too.
Your code looks good (having not tested it) - it could be greyed out if you have more data on the form than what the barcode can handle.
You can build any string (eg write script to build the exact string) you want to store in the barcode.
If you look into the Designer help file, under keyword "paper forms barcode object" you'll be able to find the whole explanation, including sample code for only inlcuding named fieldsin the "encoding data in a subform" section. Optionally base the selection using mapping to individual subforms, which could allow you to group the data without scripting.
Good luck,
Sanna