Create a form with list box
Create reference to database [ msado25.dll ] or you can use any version.
Dim objCnn As New ADODB.Connection
Dim objRss As New ADODB.Recordset
Private Sub Form_Load()
objCnn.ConnectionString = "Provide your connection string here"
objCnn.Open
Set objRss = objCnn.Execute("Select <fieldName> from <tablename>")
Do While Not objRss.EOF
lstUsers.AddItem objRss.Fields(0).Value
objRss.MoveNext
Loop
This will populate the list box with values.
In design mode itself you can set the Style property of the list box to 1-Checkbox
Or through code you can do like lstUsers.Style = 1.
Boss,
You can Use "Data List" or "Data COmbo" boxes. These are available in "VB Enterprise Edition Controls."
and set properties :
datasource = adodc1
rowsource = adodc1
listfield = "name of field which you want to add to list"
Works best for want you want.
Hi Guest we just wanted to alert you to a major change in the forum. We will no longer be allowing the posting of outgoing links. Please use the attachment feature to attach media to your posts.