0

Hi All,

I had puted out my records from database and place them in Datagrid. Than I try to filter out unwanted records based on user inputed date (by using 2 DTPicker, a START DATE and END DATE). And I encounter this problem "Run-time error '3001'". Anyone has any idea what went wrong? Or maybe a better way to filter out those records?

Here is my code...

With Adodc1.Recordset
.Filter = "DOC_DATE Between CStr(DTPicker1.Value) And CStr(DTPicker2.Value)"
If .EOF Then
MsgBox "Item " + txtCustomer.Text + " Not found"
.Requery
txtCustomer.SetFocus
End If
End With

.. .. .. ..

Any help is appreciated.

Thanks.

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by benjaminhan
0

Try using only 1 dtpPicker and a text box. Add date selected to the textbox.
In your code add following:
[Set rsAuthorise = New ADODB.Recordset]
[rsAuthorise.Open "SELECT * FROM tablename WHERE] [DateOrdered(your field name related to date) >= DateValue('" &] [txtdate.text & "')" & " ORDER BY DateOrdered", cnConnection,] [adOpenStatic, adLockOptimistic]

0

Hi AndreRet,

Thank for your reply. It really works by using only one dtpPicker.
Thank you :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.