[AccessD] Determine whether list box control has a selected value

jack drawbridge jackandpat.d at gmail.com
Tue Nov 3 15:28:39 CST 2015


Susan,

Here is a snippet

Private Sub MoveDown_Click()
'
' with Access Listbox.column(columnindex, row)
           '
           ' Move Items Down
           ' Allow multicolumn items to move
           '
          Dim lngIndex As Long
          Dim lngStarToRow As Long
          Dim blnSelected() As Boolean  '<<<boolean array
10       On Error GoTo Movedown_Click_Error

20        With listbox1
30            ReDim blnSelected(.ListCount) As Boolean
40            For lngIndex = 0 To .ListCount - 1
50                blnSelected(lngIndex) = .Selected(lngIndex) ' <set the
boolean array according to whether the itemis selected or not
60            Next


Good luck.

On Tue, Nov 3, 2015 at 4:14 PM, FW Salato Center <Salato at ky.gov> wrote:

> I need to write a quick validation snippet for a multi-value list box.
> This control's Value property always returns Null. What's the quickest way
> to determine if something's selected? I don't need the actual value, just a
> True/False response - there's an item selected or there isn't.
>
> Thanks!
> Susan H.
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


More information about the AccessD mailing list