All a table field list to a list box in Access 2000

O

onetwothreefour

I was able to do this at work very easily with the Access 2003 object
model and some forms last week, but now I'm back to Access 2000 and I
can't seem to do it.

Quite simply: I have a form with a list box (unbound), and I want to
populate it with the fields of a table upon form_load ...

I keep trying to start with Application.[...] , but can't seem to get
anywhere!

How do I loop through the collection of fields from a table object and
use a .add method to populate that list box?
 
T

tina

is there some reason that you can't simply set the listbox control's
RowSourceType and RowSource properties in the form's Load event, as

Private Sub Form_Load()

Me!ListControlName.RowSourceType = "Field List"
Me!ListControlName.RowSource = "TableName"

End Sub

hth
 
S

Steve Schapel

Indeed. Or, for that matter, why not just enter these settings directly
to the listbox's properties in the form's design?
 
O

onetwothreefour

The form has no source
is there some reason that you can't simply set the listbox control's
RowSourceType and RowSource properties in the form's Load event, as

Private Sub Form_Load()

Me!ListControlName.RowSourceType = "Field List"
Me!ListControlName.RowSource = "TableName"

End Sub

hth


I was able to do this at work very easily with the Access 2003 object
model and some forms last week, but now I'm back to Access 2000 and I
can't seem to do it.

Quite simply: I have a form with a list box (unbound), and I want to
populate it with the fields of a table upon form_load ...

I keep trying to start with Application.[...] , but can't seem to get
anywhere!

How do I loop through the collection of fields from a table object and
use a .add method to populate that list box?
 
S

Steve Schapel

1234,

That doesn't matter. Just go to the properties for the listbox, and
enter as Tina suggested... Set the Row Source Type property to Field
List, and then enter the name of the table in the Row Source property.
The form does not need to be bound in order to do this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top