Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter Recordset on Date field 1

Status
Not open for further replies.

sogibear

Programmer
Jul 4, 2002
45
GB
Hello,

I'm trying to filter a recordset using ADO on a field of type "datetime" like so :

rstACDetails.Filter = adFilterNone
rstACDetails.Filter = "[LastUpdated] = " & Me.txtLastUpdated

unfortunately i keep getting an error message saying

Runtime error '3001':
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

Please Help
Thanks
 
Try converting your text to a date

rstACDetails.Filter = adFilterNone
rstACDetails.Filter = "[LastUpdated] = " & CDate(Me.txtLastUpdated)

--------------------------------------
It's not the monsters under your bed, it is the men next door.
That make you fear, make you cry. Make you cry for the Child.
All the wars are fought amongst those lonely men. Unharmed, unscarred.
 
Wait... no, that makes no sense. I should think before I type...

Try this instead, I think that should do it

rstACDetails.Filter = adFilterNone
rstACDetails.Filter = "[LastUpdated] = #" & Me.txtLastUpdated & "#"

--------------------------------------
It's not the monsters under your bed, it is the men next door.
That make you fear, make you cry. Make you cry for the Child.
All the wars are fought amongst those lonely men. Unharmed, unscarred.
 
thanks matee, that did the trick ! enjoy your 'helpful/expert post' point !
 
Weeeeee, my second... Hehe :) --------------------------------------
It's not the monsters under your bed, it is the men next door.
That make you fear, make you cry. Make you cry for the Child.
All the wars are fought amongst those lonely men. Unharmed, unscarred.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top