Hi,
I'm importing a text file which contains a barcode. Once imported I add a column to the table & copy the barcode into the new column (So far I've done all of this using code).
I want to re-format the new column so that all the barcodes are 13 digits long (some are 7, some are 6 etc, etc). Where any barcodes are not 13 digits long, I want to add leading zero's until they are all 13 digits long. This is where I'm getting stuck. I wrote a real basic piece of code but when I run it I get a "run time error 424, "Object Required" message.
Here is an example of what I wrote:
I'm a complete novice really just trying to learn some basics in coding etc to maybe help automate some tasks; so any help or guidance will be appreciated.
Thanks,
BEP
I'm importing a text file which contains a barcode. Once imported I add a column to the table & copy the barcode into the new column (So far I've done all of this using code).
I want to re-format the new column so that all the barcodes are 13 digits long (some are 7, some are 6 etc, etc). Where any barcodes are not 13 digits long, I want to add leading zero's until they are all 13 digits long. This is where I'm getting stuck. I wrote a real basic piece of code but when I run it I get a "run time error 424, "Object Required" message.
Here is an example of what I wrote:
Code:
Function Test() Dim OneZero As String Dim TwoZero As String OneZero = "0" TwoZero = "00" If Len(AllTitles.[ASDABarcode]) = 12 Then AllTitles.[ASDABarcode] = OneZero & AllTitles.[ASDABarcode] End If End Function
Thanks,
BEP
Comment