Hi I was just curious if you could place a value in a third column of a listbox item. I have a form that highlights the records that have already been selected and I want to put a string value and possible a hyperlink.
First column , Primary Key, hidden
second column Name, visible
third column either Add or Delete based on if the item is selected.
I have the code that hightlights the selected items just need to see how I can add the data in the third column
'code to highlight selected records in list box
Do While Not rsList.EOF
.FindFirst "[Change Type ID] =" & rsList.Fields(0)
lngID = .AbsolutePosition
frmName.Change_Type_ID.Selected(lngID) = True
its a technique that works if you don't have a large amount items int he listbox, you have a slow network and so on...
it can be quite useful to pull several items in one hit, rather than having to do several dlookups or open a recordset.
however be warned its only appropriate for a few occasions
where the data you want to retrieve is static... ie it isn't going to change over time. storing data in the list box is ok but it only gets populated at the time the form loads, or if you refresh the control, so there is a risk that the data may be out of date.
its not appropriate for large amounts of data... each and every element you store in the control requires memory, ok in these days of multi GB Ram & pagefiles/vm its less of a problem. its not a good idea if the form is used for a short time, you spend a lot of time loading the form, populating the list/combo box and then close it after a few uses.
it doesn't scale too well to other SQL engines, other than JET. populating combo boxes is something that can be a real resource hog in server db's. not because of any signifdicant problem.. just that you are trucking a lot of data around the network, which is of limited use. Arguably big recordsets may be better handled by partial loads of combo.listboxes, based on what the user types (eg if they type A load all customers starting with A)
Ive used the technique to store a series of values, due primarily the network being clogged and very very slow.. it worked a treat. but you could get the same effect by storing copies semi static values at runtime.. ie create local copies of the tables when the application first opens.
So I have have 4 values that are returning in the list box, and currently I have the code to highlight the selected values. But I want a hint on how to put a Hyperlink in a 3rd column of the list box. if the item was selected it would the string in the 3rd column would say Delete and if not selected it would say Add.
I have tried to use the .column method of the list box but I can only figure that it is to read data and now add it. Is there another way to add data to a column?