From: Hans Up on
Salad wrote:
> Albert D. Kallal wrote:
>> "Marshall Barton" <marshbarton(a)wowway.com> wrote in message
>> news:i13m061r3e7ldnck2lhkanh5cauu4855i0(a)4ax.com...
>>
>>> That's pretty elaborate and should cover all kinds of
>>> situations. Personally, the few times I needed that kind of
>>> thing, I used Albert's Multi Select example at:
>>> http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
>>> --
>>> Marsh
>>>
>>
>> Thanks Marsh.
>>
>> My example works with un-bound boxes and the whole thing is run by
>> less then 10 lines of VBA code.
>>
>>
> I hadn't seen anyone discusss something like a virtual checkbox b4 so I
> wrote my little app and posted it. I was hoping there'd be an
> alternative to it so I was pleased that Marshall pointed me towards yours.

I took a different approach to virtual check boxes, based on an article
at Database Journal by Danny Lesandrini:

Create In-Memory ADO Recordsets
http://www.databasejournal.com/features/msaccess/article.php/3846361/Create-In-Memory-ADO-Recordsets.htm

I put code in the form close event to build a string of the EmpoyeeID
values for the selected rows in the datasheet form and display the
selections in a message box. It's pretty simple, but seems to work OK.

Private Sub Form_Close()
Dim rst As ADODB.Recordset
Dim strSelections As String
Dim strMsg As String

strSelections = vbNullString
Set rst = Me.Recordset.Clone
With rst
.MoveFirst
Do While Not .EOF
If .Fields("Selected").Value Then
strSelections = strSelections & _
", " & .Fields("EmployeeID")
End If
.MoveNext
Loop
End With
Set rst = Nothing

If Len(strSelections) > 0 Then
strMsg = "Selected: " & Mid(strSelections, 3)
Else
strMsg = "No selections."
End If
MsgBox strMsg
End Sub
From: Salad on
Hans Up wrote:

> Salad wrote:
>
>> Albert D. Kallal wrote:
>>
>>> "Marshall Barton" <marshbarton(a)wowway.com> wrote in message
>>> news:i13m061r3e7ldnck2lhkanh5cauu4855i0(a)4ax.com...
>>>
>>>> That's pretty elaborate and should cover all kinds of
>>>> situations. Personally, the few times I needed that kind of
>>>> thing, I used Albert's Multi Select example at:
>>>> http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
>>>> --
>>>> Marsh
>>>>
>>>
>>> Thanks Marsh.
>>>
>>> My example works with un-bound boxes and the whole thing is run by
>>> less then 10 lines of VBA code.
>>>
>>>
>> I hadn't seen anyone discusss something like a virtual checkbox b4 so
>> I wrote my little app and posted it. I was hoping there'd be an
>> alternative to it so I was pleased that Marshall pointed me towards
>> yours.
>
>
> I took a different approach to virtual check boxes, based on an article
> at Database Journal by Danny Lesandrini:
>
> Create In-Memory ADO Recordsets
> http://www.databasejournal.com/features/msaccess/article.php/3846361/Create-In-Memory-ADO-Recordsets.htm
>
>
> I put code in the form close event to build a string of the EmpoyeeID
> values for the selected rows in the datasheet form and display the
> selections in a message box. It's pretty simple, but seems to work OK.
>
> Private Sub Form_Close()
> Dim rst As ADODB.Recordset
> Dim strSelections As String
> Dim strMsg As String
>
> strSelections = vbNullString
> Set rst = Me.Recordset.Clone
> With rst
> .MoveFirst
> Do While Not .EOF
> If .Fields("Selected").Value Then
> strSelections = strSelections & _
> ", " & .Fields("EmployeeID")
> End If
> .MoveNext
> Loop
> End With
> Set rst = Nothing
>
> If Len(strSelections) > 0 Then
> strMsg = "Selected: " & Mid(strSelections, 3)
> Else
> strMsg = "No selections."
> End If
> MsgBox strMsg
> End Sub

Cool. Thanks for the alternative.