Help with Listbox (Adding More Than One Field From A Access Table) 
Author Message
 Help with Listbox (Adding More Than One Field From A Access Table)

I have an simple table in access with several fields and I want to put more
than one field in the listbox for each record.  I can get the first field
(Country) in the listbox but I can not get the second one (Currency) in the
same listbox.  I would like to seperate these two fields with a hyphen.
Here is the code I have so far:

Private Sub Form_Activate()
datcntry.Recordset.MoveFirst
Do While Not datcntry.Recordset.EOF
    List1.AddItem datcntry.Recordset.Fields("country")
        datcntry.Recordset.MoveNext
Loop
End Sub



Mon, 02 Jun 2003 02:30:44 GMT  
 Help with Listbox (Adding More Than One Field From A Access Table)
Try     List1.AddItem datcntry.Recordset.Fields("country") & " - " &
datcntry.Recordset.Fields("Currency")

Cheers

Paul


Quote:
> I have an simple table in access with several fields and I want to put
more
> than one field in the listbox for each record.  I can get the first field
> (Country) in the listbox but I can not get the second one (Currency) in
the
> same listbox.  I would like to seperate these two fields with a hyphen.
> Here is the code I have so far:

> Private Sub Form_Activate()
> datcntry.Recordset.MoveFirst
> Do While Not datcntry.Recordset.EOF
>     List1.AddItem datcntry.Recordset.Fields("country")
>         datcntry.Recordset.MoveNext
> Loop
> End Sub



Mon, 02 Jun 2003 04:26:43 GMT  
 Help with Listbox (Adding More Than One Field From A Access Table)


| I have an simple table in access with several fields and I want to put
more
| than one field in the listbox for each record.  I can get the first field
| (Country) in the listbox but I can not get the second one (Currency) in
the
| same listbox.  I would like to seperate these two fields with a hyphen.
| Here is the code I have so far:
|
| Private Sub Form_Activate()
| datcntry.Recordset.MoveFirst
| Do While Not datcntry.Recordset.EOF
|     List1.AddItem datcntry.Recordset.Fields("country")

    List1.AddItem datcntry.Recordset.Fields("Country") & "-" &
datcntry.Recordset.Fields("Currency")

A better way to fill a listbox with values from a database is to use the
Data-control and a DBList or DBGrid.

Johan.

|         datcntry.Recordset.MoveNext
| Loop
| End Sub
|
|
|
|
|



Mon, 02 Jun 2003 03:20:29 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help with Listbox (Adding More Than One Field From A Access Table)

2. Help Help Need to copy a field from one table into another table

3. ADO HELP required in ASP for adding fields to an Access table

4. need help please:joined tables,add new entries based on one table columns

5. How to modified existing field and add new field in existing table for Access database

6. need help please:joined tables,add new entries based on one table columns

7. Fill field in one table from field in another table

8. 3 Access fields display on one listbox

9. how to seperate multi field in listbox (like table of access)

10. how to seperate multi field in listbox (like table of access)

11. Copying the structure of one Access table to a new Access table

12. Crystal Report cannot see new field that is added to MS Access table

 

 
Powered by phpBB® Forum Software