Fill Combo with values from an access table 
Author Message
 Fill Combo with values from an access table

I need to connect to a database and fill a combobox with
the values from a table.  I can connect to the db no
problem but when i try to open the table it says the table
does not exist, i know the table exists and i know it's
not a typo. Here's the code. Can anyone help? Thanks.

Set rsTables = CreateObject("ADOCE.Recordset.3.0")
    rsTables.Open "Teachers", conndb, , , 2
    reccount = rsTables.RecordCount
    For xCounter1 = 0 To reccount - 1
        CboTeachers.AddItem rsTables.Fields
("Teachername").Value
        rsTables.MoveNext
    Next



Tue, 22 Nov 2005 00:34:04 GMT  
 Fill Combo with values from an access table
    For rs.Index = 0 To rs.RecordCount - 1
                cboTeachers.AddItem rs.Fields("Teachername").Value & ""
    rs.MoveNext
    Next


Quote:
> I need to connect to a database and fill a combobox with
> the values from a table.  I can connect to the db no
> problem but when i try to open the table it says the table
> does not exist, i know the table exists and i know it's
> not a typo. Here's the code. Can anyone help? Thanks.

> Set rsTables = CreateObject("ADOCE.Recordset.3.0")
>     rsTables.Open "Teachers", conndb, , , 2
>     reccount = rsTables.RecordCount
>     For xCounter1 = 0 To reccount - 1
>         Teachername.AddItem rsTables.Fields
> ("Teachername").Value
>         rsTables.MoveNext
>     Next



Wed, 23 Nov 2005 15:46:08 GMT  
 Fill Combo with values from an access table

'***************************************************************************
*******
Public Sub LlenarComboConCondicionesVentas(Combo As ComboBox)
'fill the combobox with the values
Dim Rs                  As Object
Set Rs = CreateObject("ADOCE.Recordset.3.1")

Rs.ActiveConnection = dbConexion
Rs.Open "SELECT COPA_NAME FROM CONDITION_PAYS ORDER BY COPA_NAME"

If Rs.RecordCount > 0 Then
    Do While Not Rs.EOF
        Combo.AddItem Rs.Fields("COPA_NAME")
        Rs.MoveNext
    Loop
End If
Rs.Close
Set Rs = Nothing
End Sub

Bye!



Wed, 23 Nov 2005 21:16:20 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Filling a combo drop down from access table

2. Connect to Access table & fill combo box

3. Method for populating a combo box (ASP) with values from an access table

4. Fill combo box with enum names and values

5. Filling the combo with the table data...

6. Filling a combo list with table names

7. Filter a Combo Box filled from an Access database

8. Filling a combo box at run time from access 2000

9. Filling a Combo Box with Access

10. Fill Combo's with text from Access-database

11. Fill Combo List using Criteria selected in another Combo List

12. Help filling second combo box from fist combo box

 

 
Powered by phpBB® Forum Software