The bar code scanner scans the bar code. The Item No. against which the bar code is assigned should be populated on Sales Line Subform.
2. Create a Purchase Order and assign Item Tracking Lines and post them. Here Item tracking Lines is assigned against Item No 1000
3. Now generate Bar codes for these Serial Nos. using Online tools.
4. Copy the bar codes to a word document and take a print out. Below is a copy of word docx.
5. Below is the code attached to fulfill the requirement
Here code is written on AfterValidate trigger for Location code because on validation of No. field the Location of subform is assigned the Location code of Header.
6. Open Sales order and keep your cursor on No. field of Sales Line sub form. Scans the bar code