filter form between two dates shown in text boxes

cos

Registered User.
Local time
Today, 17:56
Joined
Jul 13, 2012
Messages
81
Hi fellers,

it's me with my stupid data filter issue again..

right.. i have my table with dates and a continuous form to show that data. On the form i have two unbound text boxes in which i wish the user can select a date and click filter, and the form will be filtered where the date in the table is between the two dates chosen on the form..

to make this a little bit more clear, i attached a silly version of this to this post..

please take a look and see if you can help me out with this.. as i am now struggling with this for quite some time now..

:confused:
 

Attachments

Last edited:
Can you attach a copy of the db in A2003 mdb format.
 
this is all i can attach it as =(
 
nvm.. this seems to work:

Code:
Private Sub FilterBtn_Click()

Dim strFilter As String
Dim strDateStart As String
Dim strDateEnd As String

strDateStart = "#" & Format(Forms![FRM_Visit]![DateFilter1], "yyyy-mm-dd") & "#"
strDateEnd = "#" & Format(Forms![FRM_Visit]![DateFilter2], "yyyy-mm-dd") & "#"

strFilter = "VisitDate >= " & strDateStart & " And VisitDate < " & strDateEnd

Me.Filter = strFilter
Me.FilterOn = True

End Sub
 
Look at DateFilterDB.zip (attachment, zip)
Open form and try.
I forgot, look at "RECORD SOURCE" (in the form).
 

Attachments

Last edited:
thanks again mate!!

i tried that be4, but for some reason it didnt work..

many thanks again :)
 

Users who are viewing this thread

Back
Top Bottom