Filter a continuous form

CanWest

Registered User.
Local time
Today, 16:01
Joined
Sep 15, 2006
Messages
272
I am trying to filter a continuous form to show only records between two dates. On the form I have a field call ScheduledStartDate and two text boxes one call txtStartDate and the other named txtEndDate. I allso have a command button named cmdApplyDateFilter with the following code.

Code:
Private Sub cmdApplyDateFilter_Click()

    Me.Filter = Me.ScheduledStartDate = " Between #" & Me.txtStartDate & "# and #" & Me.txtEndDate & "# "
    Me.FilterOn = True

End Sub

It 'appears' to work but returns no records when i enter a date in each of the ext boxes. The dates are in a valid date format similar to 0810/2011 and 08/31/2011

I know for a fact that there are records that fall into this date range. Any Ideas would be greatly appreciated.
 
Hi..

with between operator, equal operator should not be used.. also, Try giving the full path of the text boxes ..:

Code:
Me.Filter = "[ScheduledStartDate] Between [Forms]![form_name]![txtStartDate] And [Forms]![form_name]![txtEndDate]"
Me.FilterOn = True

it's another way..:

Code:
docmd.applyfilter, "[ScheduledStartDate] Between [Forms]![form_name]![txtStartDate] And [Forms]![form_name]![txtEndDate]"

I hope that helps..
 
Hi..

with between operator, equal operator should not be used.. also, Try giving the full path of the text boxes ..:

Code:
Me.Filter = "[ScheduledStartDate] Between [Forms]![form_name]![txtStartDate] And [Forms]![form_name]![txtEndDate]"
Me.FilterOn = True

I hope that helps..

That worked perfectly. Thank you, Thank you, Thank you. I have been ripping what little hair I have left out.
 

Users who are viewing this thread

Back
Top Bottom