Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello! combo box wont populate. Need help please. 1

Status
Not open for further replies.

miscluce

MIS
Oct 4, 2007
149
US
I am trying to populate a cbobox1 but i get nothing. This exact same code works on my list box1 but not my combo box. can someone tell me why this is ?

'this code works.
'populates lstbox 1
Do Until rsContacts.EOF
lstbox1.AddItem rsContacts!intContactId & "," & rsContacts!txtFirstName
rsContacts.MoveNext
Loop

'below code wont work ??????????
'populates cboBox1
'populate cbobox1 with values from a specified list
With cboBox1
.RowSource = ""
.ColumnCount = 2
.RowSourceType = "Value List"
.LimitToList = True

Do Until rsContacts.EOF
.AddItem rsContacts!intContactId
rsContacts.MoveNext
Loop

End With

thnaks in advance
 

If you define these
.RowSource = ""
.ColumnCount = 2
.RowSourceType = "Value List"
.LimitToList = True

in the design and not in code?
 
I am doing this in Access 2007 VBA.

I dont know whats goug on? I have the value list property set and I named them with the correct name(lstbox1 and cboBox1)

'this code works
'populates lstbox 1
Do Until rsParts.EOF
lstBox1.AddItem rsParts!Manufacturer & "," & rsParts!Category
rsParts.MoveNext
Loop

'this code dont work?????
'populates cbBox1
Do Until rsParts.EOF
cboBox1.AddItem rsParts!Manufacturer & "," & rsParts!Category
rsParts.MoveNext
Loop
 
Should you have a rsparts.findfirst? Since the first loop goes until end of file do you not have to restart at the top?

ck1999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top