field list - VBA

  • Thread starter Thread starter VilMarci
  • Start date Start date
V

VilMarci

Hi,

I'm trying to create a search form my database.

How can I use a table's field names as a list?
I know how to walk through the fields of the recordset.

For varMezo = 1 To rsCimek.Fields.Count
'now I know that the fields begin with 0, so I need to add a -1 here
Next varMezo

How can I put the values I get here into the combo box as row source?

Thanks for any help.
Marton
 
Marton,

In the design of your combobox, you can set the Row Source Type property
to "Field List", and the Row Source property to the name of the
applicable Table or Query.
 
Hi,

Yes, that is ok but:
I know it was my mistake...

I have two combo box:
I the first I have all my tables
In the second I'd like to have the fields in the table selected in the first
one.

How can I make it?
Marton
 
Marton

I assume you have a table that lists all the fields in all the tables.
If not, you will need one! Make a query based on this table, and in the
Criteria of the Table field, put the equivalent of...
[Forms]![NameOfYourForm]![NameOfTablesCombobox]

Then, on the After Update event of the Tables combobox, put code like
this...
Me.NameOfFieldsCombobox.Requery
 
Back
Top