Drop Down List Of Addresses 关注

0
Avatar
Legacy Poster

I would like to have a drop down list of addresses from an excel database.  How would i go about creating this?  Does it require VB Script if so what i need to accomplish this?

 

S:\Shipping\BarTender Labels\Lawson

 

Column A

1 评论

0
Avatar
Ian Cummings
版主
评论操作 固定链接

Yes a VB script will be needed for the drop down list form control as we don't support a database lookup option directly.  Here is the code that we use to populate a list control in the BarTender prompt form.  Note that there are some items that are likely to change depending on the data file, its structure and what data exactly is wanted for this list.

 

 

 
Functions and Subs
dim objConn
dim strConn
dim rs

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='c:\items and item numbers.xls';Extended Properties=""Excel 8.0;HDR=YES;"""

Public Function GetNames()
    Dim strNames

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

    strNames = ""
    rs.MoveFirst()
    do while NOT rs.EOF
        strNames = strNames + rs.fields("Item") + vbCrLf
        rs.MoveNext()
    loop

    GetNames = strNames

End Function

 

 

OnFillList
 
Value = GetNames()

 

 

请先登录再写评论。