How to fill a List box in access 2000

  • Thread starter Thread starter Michael Turner
  • Start date Start date
M

Michael Turner

Hi

Can anyone advise the code to fill a list box programmatically from a
recordset in Access 2000.

There does not appear to be an ".additem" function for the list box object.
(e.g lstbox.additem)


Thanks in advance

Mick
 
As far as I'm aware, .AddItem was introduced in Access 2002.

There are 3 ways to populate a list box in Access:
1) Base it on a query (so that you'd add the new record to the table and do
a requery)
2) Hard-code the values (so that you'd add the details to the string of
values and do a requery)
3) Use the call-back function to populate the list (details in the Help
file)
 
Or you can write code to do the "equivalent"of AddItem:

retrieve the RowSource value list
concatenate the new value(s) to it
save it back into the RowSource

Alas, I can't remember if you have to Requery after you do this.

Just for the record, .AddItem only works on value lists not on Row Sources
of a table, a query, or a callback function.

Larry Linson
Microsoft Access MVP
 

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

Back
Top