Travails of the multi-select listbox

kj2757

New member
Local time
Today, 07:35
Joined
Apr 8, 2016
Messages
3
Greetings,

I have an issue which I'm hoping to get some help with. There is a DynaSet form which is tied to a table called: tblBasicInfo.

Everything works as expected except for a listbox. I have placed a checkbox next to it, to allow users to select all the entries:

Code:
Private Sub chkAllSpecialties_Click()

    Dim i As Integer
    
    Dim selection As Boolean
    selection = chkAllSpecialties.Value
        
        For i = 0 To lstSpecialties.ListCount - 1
            lstSpecialties.SetFocus
            lstSpecialties.Selected(i) = selection
        Next i

End Sub

This works as expected. But I can't seem to get the selected values stored in the Control Source field (which is a Long Text field).

The values don't get stored even if I manually select values. The values for all other fields (including the checkbox) get stored and populate upon form load as expected.

Any insight with this issue is greatly appreciated.
 
Thank you very much for tour reply and the link. I read through the example and could certainly code the behavior. But the client does not have the means to maintain programming on their own. I did update the underlying field to a multi-select and the control to be a listbox. So now, multiple selections are getting stored.

But I'm still trying to allow the user to have an check/un-check All option. The check-box logic works correctly and selects/un-selects all the value on the multi-value listbox:

Code:
Private Sub chkAllSpecialties_Click()
    Dim i As Integer
    
    Dim selection As Boolean
    selection = chkAllSpecialties.Value
        
        For i = 0 To SpecialtiesSelected.ListCount - 1
            SpecialtiesSelected.Selected(i) = selection
        Next i
End Sub

But the field does not get updated upon moving to the next record. If the values are selected manually (as opposed to via the code), the underlying field is indeed updated.
 
Please explain this in more detail
But the field does not get updated upon moving to the next record.

Which field exactly?

I did update the underlying field to a multi-select and the control to be a listbox
multi-select??? do you mean multivalue?? Few would suggest using a multivalue field.
 
I haven't (and likely won't) use a multi value field, so can't say why it doesn't update for you.
 
Yes - it is a multi-value field. And that field (in our case named "SpecialtiesSelected") would be the the one I would expect would get updated since it's control is what is being put on the form by way of a multi-select listbox. "SpecialtiesSelected" (the multi-value field) does get updated when selections are made by hand. That field does not get updated when I use the Select All check box to select all the values appearing on the list box.
 

Users who are viewing this thread

Back
Top Bottom