By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,994 Members | 2,073 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,994 IT Pros & Developers. It's quick & easy.

List Checkbox

P: 63

I am loading data into a listcheckbox at form load.
I want to make sure tht all the checkboxes in the listbox are check how do I do this

Sub PopulateListBox()
Dim strSQL As String
Dim rsRoute As Dao.Recordset
Dim temp As Long

strSQL = "SELECT Distinct(Item) FROM ItemsInOrder;"

Set rsRoute = gdbFML.OpenRecordset(strSQL, dbOpenDynaset)
i = 0
If Not rsRoute.EOF Then

Do While Not rsRoute.EOF
temp = rsRoute!item
'MsgBox temp
List1.AddItem temp, i
i = i + 1
MsgBox "No Data available"
Unload Me
End If
End Sub

This is my subroutine which populates the listbox

Thanx in advance
Sep 7 '07 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 1,445

Change ur loop :

Expand|Select|Wrap|Line Numbers
  1. Do While Not rsRoute.EOF
  2.    temp = rsRoute!item
  3.    List1.AddItem temp, i
  4.    List1.Selected(List1.NewIndex) = True
  5.    rsRoute.MoveNext
  6.    i = i + 1
  7. Loop
Sep 7 '07 #2

P: 63
Cool thanx a lot it works
Sep 7 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.