Linking Drop Down List To Barcode Field S’abonner

0
Avatar
Legacy Poster

Hey guys,

I really need your help. I'm really not a programmer but I managed to follow the forums and read a lot to complete the following script. I could really use your guidance to complete the following scenario. On the data entry form I have a drop down list that selects the different types of labels that we need to print. It takes the information from an excel database. This is working fine. Here is my script:

dim objConn
dim strConn
dim rs

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Users\jolague\Documents\Label Printing\Product UPC Registration Database.xls;" & _
";Extended Properties=""Excel 8.0;HDR=YES;"""

Public Function CATNUM1()
Dim strNames

Set objConn = CreateObject("ADODB.Connection")
objConn.Open strConn
Set rs = CreateObject("ADODB.Recordset")
rs1= "SELECT * FROM [Sheet1$]"
Set rs = objConn.Execute (rs1)

strNames = ""
rs.MoveFirst()
do while NOT rs.EOF
strNames = strNames + rs.fields("Reference #") + vbCRLf
rs.MoveNext()
loop

CATNUM1 = strNames

End Function

However, the part that I don't know how to fix is that each of the items in the Reference # column in my database has an assigned barcode GTIN that needs to print as well as the value in my dropdown list. In other words I need the barcode to follow whatever reference # I select. How can I link the two fields to print all the information on the label? Can a single entry (selection of product to print in dropdown list) be enough to print the product and the barcode?

1 commentaires

0
Avatar
Shotaro Ito
Actions pour les commentaires Permalien

Hi Jolague,
Roughly you have two option to share value in between objects:

#1. Object Value (Label object string)
If you have a text called "Text 1", you can use that "Text 1"'s value in other datasource.
Create a barcode and in datasource, change source type to "Object Value"(or Label object String in v9.4 or older), specify source object as "Text 1".
With object value source, you can modify value by Apply data type or apply transform (More options in v9.4 or older.).

#2. Named datasource (Named substring)
You can name datasource from [Name] of datasource. When two or more datasource has the same name, the value of the datasouces are shared.
Note all Transforms are shared too - including data entry and VB Script.

In the barcode's datasouce, try [Object Value] source of another text which uses dropdown value - note you can have multiple datasource within a barcode / text.
(In 9.4 or older, you can show substring list from [Advanced >>] button on Datasource tab)

Vous devez vous connecter pour laisser un commentaire.