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

  • Thread starter Thread starter onetwothreefour
  • Start date Start date
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?
 
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
 
Indeed. Or, for that matter, why not just enter these settings directly
to the listbox's properties in the form's design?
 
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?
 
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.
 
Back
Top