leighcloon
New member
- Local time
- Today, 02:55
- Joined
- Jan 13, 2004
- Messages
- 5
Hi,
Based on a value entered in a text box, once the user presses enters, I want to assign values to a combo box.
I have read that the method to do this is AddItem, but it does not appear in the properties for a combo box when I write it in the code.
When i run it, i get the error, Data or method not found
Any help would be much appreciated
Here is my code:
Dim rs As New ADODB.Recordset
Dim strsql
strsql = "Select * from Products2 where [Product Group] = " & "'" & Spend_Category & "';"
rs.Open strsql, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If Not rs.EOF And Not rs.BOF Then
rs.MoveFirst
Do While Not rs.EOF
cboSubCat.AddItem rs!Product
rs.MoveNext
Loop
End If
Based on a value entered in a text box, once the user presses enters, I want to assign values to a combo box.
I have read that the method to do this is AddItem, but it does not appear in the properties for a combo box when I write it in the code.
When i run it, i get the error, Data or method not found
Any help would be much appreciated
Here is my code:
Dim rs As New ADODB.Recordset
Dim strsql
strsql = "Select * from Products2 where [Product Group] = " & "'" & Spend_Category & "';"
rs.Open strsql, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If Not rs.EOF And Not rs.BOF Then
rs.MoveFirst
Do While Not rs.EOF
cboSubCat.AddItem rs!Product
rs.MoveNext
Loop
End If