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!

Value Selection In A Listbox

Status
Not open for further replies.

hoppergs

IS-IT--Management
Feb 24, 2003
39
GB
If you select some values from a multi-select listbox, then save and re-open the form that it's in, these selections disappear.

Do you know if there's any way that when the form is re-opened, these selections can still be there? I know you can do this for combo-boxes using VBA but I'm struggling with listboxes!!

Any help is much appreciated - thanks.

Graham
 
The way to do it is that YOU need to store the information somewhere.

When you select items in a list box you are changing how the form and control look to the user. You are not changing data in the underlying table.

So, how do you intend to store this data ?
Will you have a table at the many end of a one-many link with your main table ?
Or will you ( heaven forbid ) concatenate the data together into one field in the main table ?





G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
I've concatenated the data into one field. What I want to do is somehow get the listbox to read this data back into it so that they appear selected when the user goes back in.

Is this easily done?

Thanks for your response.
 
No, by concatenating data you've overwritten 'easy' with 'pain_in_the_..end'

You need to :-
get the concatenated string into a variable
extract the individual elements
For each element in concatenated list
identify the row in the list box that matches
set the row to 'Selected'
Next



'ope-that-'elps.

G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
Seems to make a lot of sense.......thanks for your help again, mate.

Graham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top