Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using a list box in both Access 2002 and 2000

Status
Not open for further replies.

davedoop

Programmer
Apr 12, 2004
8
US
I have a list box in my application that i would like to use in both Access 2002 and 2000. Access 2002 uses the 10.0 Object Library, Access 2000 uses the 9.0 Object Library. In Access 2002 I used ListBox.AddItem and ListBox.RemoveItem to empty and populate the control. However, these methods aren't available in Access 2000. Anyone have a good way to empty and populate a list box in both versions of Access? Thanks for your help...
 
Use a RowSourceType of Value List and make the RowSource a semi-colon (;) separated list of items.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
The easiest, is if you could assign a table or query as the rowsource for the list (or combo). Else you'd need to use other means of populating. If the rowsource does not exceed 2k (2048) characters, then you can use concatination:

[tt]dim s as string
do while not rs.eof
s= s & rs.fields("yourfield").value & ";"
rs.movenext
loop
me!mylist.rowsource=s[/tt]

- simple (typed not tested) sample using a recordset

For more than 2048 characters, take a look at using callback function (samples exist in the help files and should also be found by a keyword search in the access fora)

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top