Hi Experts,
I'm trying to filter some data using SQL query on Access 2000 db.
Thing is that I'm getting run-time error '3001' - "Arguments are of the wrong type, are out of acceptable range, or in conflict with one another"
here is what I have so far:
Can anyone tell me what I'm doing wrong here?
Thanks,
Yoav
I'm trying to filter some data using SQL query on Access 2000 db.
Thing is that I'm getting run-time error '3001' - "Arguments are of the wrong type, are out of acceptable range, or in conflict with one another"
here is what I have so far:
Code:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sSql As String
Dim day1 As Variant, day2 As Variant
cn.Open "DSN=Process"
rs.Open "Data ORDER BY [Line] ASC", cn, adOpenKeyset, adLockOptimistic
If IsNull(frmData.dtpFrom.Value) = True Then
day1 = frmData.dtpFrom.MinDate
Else
day1 = frmData.dtpFrom.Value
End If
day2 = frmData.dtpTo.Value
'On Error GoTo err
day1 = "#" & day1 & " 00:00:01#"
day2 = "#" & day2 & " 23:59:59#"
sSql = "Line like 'LINE-2%' AND (Side='P.S.' OR Side='C.S.') AND Date BETWEEN (" & day1 & " AND " & day2 & ")"
rs.Filter = sSql
Can anyone tell me what I'm doing wrong here?
Thanks,
Yoav