Identical Number Of Copies Is Sourced By A Data Source. Identical Number Of Copies Must Be Sourced By The Print Dialog. Follow

0
Avatar
Legacy Poster

I am using bartender 9.4 EA activeX with vb.net. and below is my code to print the label

[code] btApp.Visible = False
btFormat = btApp.Formats.Open(strLabelPath.Trim, False, "")

btDb = btFormat.Databases.GetDatabase(1)
btDb.OLEDB.UserId = p_objGlobalConn._DBUserID
btDb.OLEDB.Password = p_objGlobalConn._DBPassword
btDb.OLEDB.SQLStatement = strSQL.Trim

btFormat.IdenticalCopiesOfLabel = strCopy.Trim /*<-- hit error*/

btFormat.Printer = strPrinter.Trim
btFormat.PrintOut(False, False)
btFormat.Close(BtSaveOptions.btDoNotSaveChanges)[/code]

Originally this code was OK. But when I chenge the label templates, under the file-Print, Identical copies of label and number of serialized labels i set to database field, it hits the error. if I comment out the "btFormat.IdenticalCopiesOfLabel". it does not print anything.

How to use the identical copy from the label template? I would like to set the identical copy from the database field.

5 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

If you data source the number of identical labels to print in the label format from a database field, why do you need to specify it in code?

In the data source for the print quantity in the label format, make sure that the default value for the field is set to 1.

Out of interest, if you specify a literal numeric value does the code work okay printing that number of labels?
0
Avatar
Legacy Poster
Comment actions Permalink

Thanks for your reply.

Sorry to say I forget to mention, let take a look for my scenario

Specific identical label on coding and hardcode the printing label setting copy to 1 = working fine
do not specific identical label on coding and set the printing label to database field = nothing printed
0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

Could re-phrase your last point as I don't quite understand it.
0
Avatar
Legacy Poster
Comment actions Permalink

[code] btApp.Visible = False
btFormat = btApp.Formats.Open(strLabelPath.Trim, False, "")

btDb = btFormat.Databases.GetDatabase(1)
btDb.OLEDB.UserId = p_objGlobalConn._DBUserID
btDb.OLEDB.Password = p_objGlobalConn._DBPassword
btDb.OLEDB.SQLStatement = strSQL.Trim

btFormat.Printer = strPrinter.Trim
btFormat.PrintOut(False, False)
btFormat.Close(BtSaveOptions.btDoNotSaveChanges)

[/code]

if I using the code above and set the identical copy as database field, nothing is printed.
0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

1. I take it that if the value of identical copies is left at a literal value of 1 then your select statement does return records to print?

2. The code seems fine to me.

3. Are you sure that the field you specified for the print quantity contains valid integer data? Did you specify a default value of 1 in the BarTender document like previously mentioned?

4. Enable application message logging in BarTender and check for any error generated. Do this via the "Administer>Application message setup" menu item.

Please sign in to leave a comment.