Skip to main content

Search

Search

Return A Recordset From An Sql Query

Comments

3 comments

  • Avatar
    Fernando Ramos Miracle
    Moderator

    Hello Rickerman,

     

    Thanks for your email.

     

    I'm not exactly sure of what you are requesting, do you wish the user to be able to select a single record from a database using a dropdown list, and then make sure other objects source information from different fields of that selected record?

     

    I don't fully understand what you meant when saying "I want bartender to treat each record in the recordset as a new label.". Isn't BarTender printing a different label for each record the user selects at print time?

     

    *Not that if you are working with a custom database connection (through VB script) the supported BarTender connection won't work (you need to choose one or the other).

     

    In any case, I can recognize the code you've provided from one of our examples, I'm attaching what it's probably a more advanced one for this same purpose that the ones we'be attached so far (that could probably be more helpful). Please take a look at it and let me know if it helps.

     

    If you need further help please explain in more detail what exactly do you wish to achieve.

     

    Regards.

    0
  • Avatar
    Legacy Poster

    Hello Rickerman,

     

    Thanks for your email.

     

    I'm not exactly sure of what you are requesting, do you wish the user to be able to select a single record from a database using a dropdown list, and then make sure other objects source information from different fields of that selected record?

     

    I don't fully understand what you meant when saying "I want bartender to treat each record in the recordset as a new label.". Isn't BarTender printing a different label for each record the user selects at print time?

     

    *Not that if you are working with a custom database connection (through VB script) the supported BarTender connection won't work (you need to choose one or the other).

     

    In any case, I can recognize the code you've provided from one of our examples, I'm attaching what it's probably a more advanced one for this same purpose that the ones we'be attached so far (that could probably be more helpful). Please take a look at it and let me know if it helps.

     

    If you need further help please explain in more detail what exactly do you wish to achieve.

     

    Regards.

    Hello Fernando,

     

    Please see attached sample that I remade from yours, I added "distinct" to Downlist box  and added a record "Apple" to fruits.xls, so 2 results will be returned when I search "Apple", I want to print these 2 records out, can I do?

     

    Thanks!

    MHYX

    0
  • Avatar
    Legacy Poster

    @mhyx: Try this: Put the code that is now in OnNewRecord into OnPostPrompt (maybe it also works in OnNewRecord - not sure. Try whatever location is most logical for your application ;)). Add the "Value = rs.Fields("xx")" line to OnIdenticalCopies. The script should pull the matching records (from the user entry selection) into a recordset, then print a label/record for all matching records. But at this stage, you still have to tell BarTender manually, how many labels you will be printing. To solve this, assign a named data source to the "Copies" entry in the print dialog. Then use rs.RecordCount after the recordset has been created in the script and assign its value to the "copies" data source.

    0

Please sign in to leave a comment.