Skip to main content

Search

Search

Printing Multiple Rows From Database Result On A Single Label Page

Comments

6 comments

  • Avatar
    Ian Cummings
    Moderator

    Currently BarTender is only able to print a maximum of a single record of data per label using BarTender's built-in database connectivity.  The question has been asked many times before in the forum, so feel free to search for information on the various workarounds possible.

    0
  • Avatar
    Legacy Poster

    Thanks for your reply. I looked for alternatives and found a VB script would work. It is as below:

     

     

    dim sServer, sConn, oConn,oRS
    sServer="aSQLServerDB"
    sConn="provider=sqloledb;data source=" & sServer & ";initial catalog= Dev"
    Set oConn = CreateObject("ADODB.Connection")
    oConn.Open sConn, "aUsername", "aPasword"
    Set rstComponents =CreateObject("ADODB.Recordset")

     

    sSQL =  "SELECT ComSerialNum"
    sSQL = sSQL & ", COALESCE (CustRevisionICS, ComRevision, '') as Revision "
    sSQL = sSQL & ", ComponentType"
    sSQL = sSQL & ", COALESCE (CustComPartNum, ComPartNum) as PartNum"
    sSQL = sSQL & ", ComponentDescription "
    sSQL = sSQL &  " FROM sp.vwLabelComponentDetail where CabSerialNum = '" & Field("vwLabelCabinetView.CabSerialNum")  & "'"
    sQQL = sSql & "Order by ComponentType asc"
    Set rstComponents = oConn.execute(sSQL)

     

    PartText1=""
    PartCode1=""
    SerialNum1=""
    Rev1 = ""
    ...
    PartText6=""
    PartCode6=""
    SerialNum6=""
    Rev6 = ""

     

    dim i
    i= 1
    Do until rstComponents.EOF
     Select Case i
      Case 1
       PartText1 = rstComponents("ComponentType")
       PartCode1 = rstComponents("PartNum")
       SerialNum1  =rstComponents("ComSerialNum")
       Rev1 = rstComponents("Revision")
       
      Case 2-5 ...

     

      Case 6
       PartText6 = rstComponents("ComponentType")
       PartCode6 = rstComponents("PartNum")
       SerialNum6  =rstComponents("ComSerialNum")
       Rev6 = rstComponents("Revision")
      Case else
     End Select
     i = i+1
     rstComponents.MoveNext
    Loop

     

    oConn.close

     

    However, I am not sure where to put this VB script in and how to map it to multiple columns on my label.

    Also, I have an oracle database whereas this script connects to sql server. can you suggest what parameters go in for connecting to an oracle DB?

    1
  • Avatar
    Legacy Poster

    Has there been any new developments on this topic since 2014? I am having the same problem as the person who started this thread.

    0
  • Avatar
    Ian Cummings
    Moderator

    JBlanchard: Yes, enable the Page Template in the BarTender Page Set-up dialog, set the page size to be that of your overall label, and the label dimension to be the size of an individual line item.  In this case you'd have one column of six rows of labels on the page.  Set the margins appropriately to help define the main part of the label from the line item region.  The attached document should help you get started with the idea here.

    1
  • Avatar
    Jason Stone

    I am trying to do this exact same thing.  I have 6 Serial #'s and MAC addresses I want to print on one label based off of query results from a dbase.  Can you send me  a copy of the attached document you mentioned?

    0
  • Avatar
    Ian Cummings
    Moderator

    Jason: I guess the example via the following link should help you out: https://goo.gl/CcKAQi 

    0

Please sign in to leave a comment.