G
gambit32
I created two multi select boxes that allow a user to make multiple
selections in each. The result is a query based on what is selected in
each box. When I try to open my query after making my selections I get
an error.
The error reads: This expression is typed incorrectly, or it is too
complex to be evaluated. For example, a numeric expression may contain
too many complicated elements. Try simplifying the expression by
assigning parts of the expression to variables.
Here's the code:
strSQL = "SELECT
datetest1_tbl.fld_year,datetest1_tbl.fld_day,datetest1_tbl.fld_month,datetest1_tbl.fld_break_mins,datetest1_tbl.fld_break_hrs,datetest1_tbl.fld_date,datetest1_tbl.fld_client,datetest1_tbl.fld_project,datetest1_tbl.fld_subproject,datetest1_tbl.fld_currency,
datetest1_tbl.fld_duration_hrs,datetest1_tbl.fld_duration_mins,
datetest1_tbl.fld_note, datetest1_tbl.fld_rate,
datetest1_tbl.fld_amount FROM datetest1_tbl "
strWhere = "Where ((datetest1_tbl.fld_date) Between
Forms!aspdash_form!date1 And Forms!aspdash_form!date2) and
datetest1_tbl.fld_client IN ("
For i = 0 To listclient.ListCount - 1
If listclient.Selected(i) Then
strWhere = strWhere & "'" & listclient.Column(0, i) & "'"
End If
Next i
strWhere = strWhere & " AND datetest1_tbl.fld_currency IN ("
For i = 0 To listemployee.ListCount - 1
If listemployee.Selected(i) Then
strWhere = strWhere & "'" & listemployee.Column(0, i) & "', "
End If
Next i
strWhere = Left(strWhere, Len(strWhere) - 2) & "));"
strSQL = strSQL & strWhere
MsgBox strSQL
....anyone have any ideas? Thanks in advance.
selections in each. The result is a query based on what is selected in
each box. When I try to open my query after making my selections I get
an error.
The error reads: This expression is typed incorrectly, or it is too
complex to be evaluated. For example, a numeric expression may contain
too many complicated elements. Try simplifying the expression by
assigning parts of the expression to variables.
Here's the code:
strSQL = "SELECT
datetest1_tbl.fld_year,datetest1_tbl.fld_day,datetest1_tbl.fld_month,datetest1_tbl.fld_break_mins,datetest1_tbl.fld_break_hrs,datetest1_tbl.fld_date,datetest1_tbl.fld_client,datetest1_tbl.fld_project,datetest1_tbl.fld_subproject,datetest1_tbl.fld_currency,
datetest1_tbl.fld_duration_hrs,datetest1_tbl.fld_duration_mins,
datetest1_tbl.fld_note, datetest1_tbl.fld_rate,
datetest1_tbl.fld_amount FROM datetest1_tbl "
strWhere = "Where ((datetest1_tbl.fld_date) Between
Forms!aspdash_form!date1 And Forms!aspdash_form!date2) and
datetest1_tbl.fld_client IN ("
For i = 0 To listclient.ListCount - 1
If listclient.Selected(i) Then
strWhere = strWhere & "'" & listclient.Column(0, i) & "'"
End If
Next i
strWhere = strWhere & " AND datetest1_tbl.fld_currency IN ("
For i = 0 To listemployee.ListCount - 1
If listemployee.Selected(i) Then
strWhere = strWhere & "'" & listemployee.Column(0, i) & "', "
End If
Next i
strWhere = Left(strWhere, Len(strWhere) - 2) & "));"
strSQL = strSQL & strWhere
MsgBox strSQL
....anyone have any ideas? Thanks in advance.