I have an odd problem. I've created a form that users can use to generate criteria for queries. Basically I am constructing a where clause. based on the selections. It works fine except when I select all the items in a list box by checking the Select All button for that list. When I select all the items individually, the first argument in the AddToWhere procedure has a value. When I use the Select All check box, the first argument has a null value, even though all the items in that list have been selected via the following code . This causes an error to be thrown.
Public Function SelectAll(lst As ListBox) As Boolean
' Params : lst
' Returns : Boolean
On Error GoTo PROC_ERR
Dim lngRow As Long
If lst.MultiSelect Then
For lngRow = 0 To lst.ListCount - 1
lst.Selected(lngRow) = True
SelectAll = True
MsgBox Err.Number & vbTab & Err.Description, vbCritical, Me.Name & ".SelectAll"
Call AddToWhere(Me.lstYear.Column(0), "lstYear", strYearCriteria, intArgCount)