rainman89
I cant find the any key..
- Local time
- Today, 06:15
- Joined
- Feb 12, 2007
- Messages
- 3,015
[Resolved] Reselect items in listbox based on records
Hi all,
So I have a set of records that I want to let people edit when they realize they have made a mistake.
Currently they select from multiple listboxes and that populates records based on their user ID
What I would like is if they already have a record for a certain term, they can go in and edit that record. Hopefully this could be done with the same form, but what I need right now is to figure out how to reselect the items in a listbox that are in the recordset.
I have the listbox bound to a generic list of possibilities and would like when they click edit for them to be able to see those items they have already selected in the listbox (highlighted)
I can currently get the records pulled into a recordset, but i cannot get the listbox to reselect.. any help would be appreciated. Thanks in advance
This works for only one record. It doesnt go through the whole 44 records that it should be...
Hi all,
So I have a set of records that I want to let people edit when they realize they have made a mistake.
Currently they select from multiple listboxes and that populates records based on their user ID
What I would like is if they already have a record for a certain term, they can go in and edit that record. Hopefully this could be done with the same form, but what I need right now is to figure out how to reselect the items in a listbox that are in the recordset.
I have the listbox bound to a generic list of possibilities and would like when they click edit for them to be able to see those items they have already selected in the listbox (highlighted)
I can currently get the records pulled into a recordset, but i cannot get the listbox to reselect.. any help would be appreciated. Thanks in advance
Code:
Set rs = Db.OpenRecordset("qry_benchskill", dbOpenDynaset)
reccount = rs.RecordCount
MsgBox reccount
rs.MoveFirst
Do Until rs.EOF
studentBench = DLookup("benchmarkID", "qry_benchskill", "studentYearID=3")
'MsgBox studentBench
For x = 0 To Me.List1.ListCount - 1
'MsgBox Me.List1.Column(0)
'MsgBox "see me?"
Me.List1.Selected(studentBench) = True
Next x
rs.MoveNext
Loop
Last edited: