"EAB1977" <(E-Mail Removed)> wrote in message
news:700fa171-02cd-49af-b1aa-(E-Mail Removed)...
> Can anyone tell me why this code is not working? It opens the report
> fine but does not enforce the filters.
>
> Private Sub btnCost_Click()
> DoCmd.OpenReport "rptCost", acViewPreview
> Reports("rptCost").Filter = Me.lstResults.Column(0)
> Reports("rptCost").FilterOn = True
> End Sub
>
I'm not sure what's wrong -- what is the value of lstResults.Column(0) ?
I would normally do this via the Where-Condition argument of the OpenReport
method:
DoCmd.OpenReport "rptCost", acViewPreview, _
WhereCondition:=Me.lstResults.Column(0)
But either way, Me.lstResults.Column(0) must evaluate to a valid
where-condition.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)