Drop Down List Of Addresses
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?
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 FunctionOnFillList
Value = GetNames()0
Please sign in to leave a comment.