fanguru1
asked on
Filtering Between dates with adodc
I am having problems with this code:
Adodc1.Recordset.Filter = "Date BETWEEN #" & dtestart & "# AND #" & dteend & "#"
I am getting an error:
Run-time error '3001':
Arguments are of the wrong type, or out of acceptable range, or are in conflict with one another.
Any help with this code would be greatly appreciated.
Thanks,
Jeff
Adodc1.Recordset.Filter = "Date BETWEEN #" & dtestart & "# AND #" & dteend & "#"
I am getting an error:
Run-time error '3001':
Arguments are of the wrong type, or out of acceptable range, or are in conflict with one another.
Any help with this code would be greatly appreciated.
Thanks,
Jeff
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I found this code and it worked fine:
FYI:
.Filter = "[OrderDate] >= #" & dtestart & "# AND [OrderDate] <= #" & dteend & " #"
FYI:
.Filter = "[OrderDate] >= #" & dtestart & "# AND [OrderDate] <= #" & dteend & " #"
BTW, fanguru1 I would seroiusly suggest you get rid of ADODC and use ADO directly.
Leon
Leon
what's the data type of OrderDate? make sure it's a Date/Time data field? Also make sure the values of dtestart and dteend is valid to the field data type.
Run-time error '3001'
error discription (Arguments are of the wrong type)
You are trying to apply date filteration to none date-type field
as ryancys said check orderdate type
and if this code works
.Filter = "[OrderDate] >= #" & dtestart & "# AND [OrderDate] <= #" & dteend & " #"
between MUST work also
regards
error discription (Arguments are of the wrong type)
You are trying to apply date filteration to none date-type field
as ryancys said check orderdate type
and if this code works
.Filter = "[OrderDate] >= #" & dtestart & "# AND [OrderDate] <= #" & dteend & " #"
between MUST work also
regards
For dtestart and dteend, if this is based on your machines locale, then it may not be the same as the DB, e.g. dd/mm/yyyy.
Have you tried doing :
"#" & Format(dtestart,"dd/mm/yyy y HH:mm:ss") & "#"
Or the respective format ot the DB you are trying to filter.
Have you tried doing :
"#" & Format(dtestart,"dd/mm/yyy
Or the respective format ot the DB you are trying to filter.
ASKER
This is the code I now have
Adodc1.Recordset.Filter = "OrderDate BETWEEN #" & dtestart & "# AND #" & dteend & "#"
I still have the same error.