Selected From Listbox as Recordset
Posted on 2000-04-05
I am trying to grab the selected records from a list box and open a recorset based on them.
I am able to grab the selected records and have them in a variable, but I need to modify their records now, and I don't seem to be able to do so. I have this feeling I will need to seperate the data from the variable. Let me give you an example:
User selects these stores from the listbox (06058 08542 12542 23854).
The variable will hold a value of "06058, 08542, 12542, 23854". That whole string is the value of the variable, so I can not search by the variable.
I am looking for suggestions on how I can get the results I need.
Current Code Posted
Public Function TransferDelivery1(frm As Form) As Integer
Dim ctlSource As Control
Dim ctlDest As Control
Dim strItems As String
Dim intCurrentRow As Integer
Dim strMessage As String
Dim bytChoice As Byte
Dim rst As Recordset
Dim dbs As Database
Dim intCount As Integer
Set ctlSource = frm!lstStores
For intCurrentRow = 0 To ctlSource.ListCount - 1
If ctlSource.Selected(intCurrentRow) Then
strItems = strItems & ctlSource.Column(0, intCurrentRow) & ", "
strMessage = "You have selected the following Store Numbers:@" & strItems & "@With a Delivery Date of " & frm.DeliveryDate1
bytChoice = MsgBox(strMessage, vbOKCancel)
If bytChoice = vbCancel Then
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strItems)
intCount = .RecordCount