If you can display the results as a list box, then that would allow
multi-selecting.
However, if you MUST use records, and they are bound to a form, then you can
simply use a collection.
Just put the following function in the forms module code
Option Compare Database
Option Explicit
Dim colCheckBox As New Collection
Public Function IsChecked(vID As Variant) As Boolean
Dim lngID As Long
IsChecked = False
On Error GoTo exit1
lngID = colCheckBox(CStr(vID))
If lngID <> 0 Then
IsChecked = True
End If
exit1:
End Function
Now, place a check box contorl on your form, and make the souce of hte check
box:
=IsChecked([id])
(we are assuming a key id of "id" here).
You then place a buttion be side the check box (or, even bettrer place the
buttion ON TOP OF THE check box, and make the buttion TRRANSPARNT.
The code for the buttion can then:
Private Sub Command13_Click()
If IsChecked(Me.ContactID) = False Then
colCheckBox.Add CLng(Me.ContactID), CStr(Me.ContactID)
Else
colCheckBox.Remove (CStr(Me.ContactID))
End If
Me.Check11.Requery
End Sub
At this point, you are free to navagbe to as many reocrds as you want, and
check them off.
You then can access the collection of checked records like:
Dim i As Integer
Dim strB As String
For i = 1 To colCheckBox.Count
If strB <> "" Then
strB = strB & ","
End If
strB = strB & colCheckBox(i)
Next i
MsgBox "selected = " & strB