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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating a List box

Status
Not open for further replies.

jasonmac

Programmer
Nov 14, 2002
175
US
Hello everyone. I have a form in access '97 that has a list box [lstCodes], a text box [txtCodes], and a command button [cmdAddCodes]. What I want to happen is the user will enter a number of characters into the textbox and when they click on the command button the value in the text box will be added to the list box. Is this possible? If so how can it be done?

Thanks in advance
Jason
 
I would suggest the easyest way of doing this would be to create a table to hold the values for the list box. You can then use the button to add a new value to the list box, then display it in the list box by re querying the list box

ian
 
The data source of a "Values" type list box is a string

DIM STR1 as string

STR1 = me.list0.rowsource

STR1 = STR1 & ";" & me.text0
me.list0.rowsource


will add the contents of me.text0 to the listbox.

You will have to requery

me.list0.requery

to get it updated

rollie@bwsys.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top