D
darren via AccessMonster.com
I need to apply the following type of filter to a subreport. However, this is
proving a lot harder than I anticipated. reading through the forum it appears
that setting criteria on a subreport is not possible and most suggest
applying critieria in the underlying query. That said how can I apply the
following via the query:
If Me.txtFromDate = "*" And Me.txtToDate = "*" Then
stLinkCriteria = stLinkCriteria & ""
ElseIf Me.txtFromDate = "*" And Me.txtToDate <> "*" Then
stLinkCriteria = stLinkCriteria & strField & " <= " & Format(Me.txtToDate,
"\#mm\/dd\/yyyy\#")
ElseIf Me.txtFromDate <> "*" And Me.txtToDate = "*" Then
stLinkCriteria = stLinkCriteria & strField & " >= " & Format(Me.
txtFromDate, "\#mm\/dd\/yyyy\#")
Else:
stLinkCriteria = stLinkCriteria & strField & " Between " & Format(Me.
txtFromDate, "\#mm\/dd\/yyyy\#") & " And " & Format(Me.txtToDate, "\#mm\/dd\
/yyyy\#")
End If
I did try writing a sub to change the sql where statement in the querydef,
but the report has a number of subreports that I need to apply this filter to
and changing the querydef for each seemed to be getting longwinded. Before I
pursue this further any better ideas?
Thanks
proving a lot harder than I anticipated. reading through the forum it appears
that setting criteria on a subreport is not possible and most suggest
applying critieria in the underlying query. That said how can I apply the
following via the query:
If Me.txtFromDate = "*" And Me.txtToDate = "*" Then
stLinkCriteria = stLinkCriteria & ""
ElseIf Me.txtFromDate = "*" And Me.txtToDate <> "*" Then
stLinkCriteria = stLinkCriteria & strField & " <= " & Format(Me.txtToDate,
"\#mm\/dd\/yyyy\#")
ElseIf Me.txtFromDate <> "*" And Me.txtToDate = "*" Then
stLinkCriteria = stLinkCriteria & strField & " >= " & Format(Me.
txtFromDate, "\#mm\/dd\/yyyy\#")
Else:
stLinkCriteria = stLinkCriteria & strField & " Between " & Format(Me.
txtFromDate, "\#mm\/dd\/yyyy\#") & " And " & Format(Me.txtToDate, "\#mm\/dd\
/yyyy\#")
End If
I did try writing a sub to change the sql where statement in the querydef,
but the report has a number of subreports that I need to apply this filter to
and changing the querydef for each seemed to be getting longwinded. Before I
pursue this further any better ideas?
Thanks