One Recordset for All Selected Datagrid Rows in SalesLogix

Question: In SalesLogix is it possible to have one recordset for all selected
datagrid rows?  I know the following to retrieve IDs for selected
datagrid rows –

For i = 0 to DataGrid1.Selection.Count – 1

id = DataGrid1.Selection(i)
‘ do something with the ID value
idlist = idlist & id & vbCrLf

and …

Set objRS = GetSelectedRecordByID(

grdProducts.Recordset, strCrntRecord, “KEYFIELDID”)
Answer:  You can use this:

Dim idlist

‘ get a list of all ID values
For i = 0 to DataGrid1.Selection.Count – 1
idlist = idlist & “‘” & DataGrid1.Selection(i) & “‘,”


‘ trim off trailing comma
If Len(idlist) > 1 Then idlist = Left(idlist, Len(idlist)-1)
‘ now open the recordset
Set rs = Application.GetNewConnection.

* from ” & Left(DataGrid1.KeyField, Len(DataGrid1.KeyField)-2)
& ” where ” & DataGrid1.KeyField & ” in (” & idlist
& “)”)

‘ now do what you want with “rs” – this is a recordset of the selected rows

are better ways to get the recordset query so you can retain the same
base query that the grid is based on. Locate the WHERE part of the
query and stick in the part for the primaryid in the IDList.


Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!