PC Review


Reply
Thread Tools Rate Thread

Report filter=form filter

 
 
Paul Mars
Guest
Posts: n/a
 
      17th Apr 2004
I have a form that has several different record sources. This form has a btn
to open a report. This report has the same record source as the current form
instance. I do this with:

Private Sub Report_Open(Cancel As Integer
Me.RecordSource = Forms!MainData.RecordSource

Now I just filtered the form instance. I thought I could then apply this
filter to the report by adding:

Me.Filter = Forms!MainData.Filter to the above code, but this does not
apply the open form filter to the report. How can I do this?

Thanks,
Paul



 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      17th Apr 2004
Did you set FilterOn to true as well?

Private Sub Report_Open(Cancel As Integer)
With Forms!MainData
Me.RecordSource = .RecordSource
If .FilterOn Then
Me.Filter = .Filter
Me.FilterOn = True
End If
End With
End Sub

That should work unless the form's filter has been set by using the
non-bound columns of your combos.

(You might also try saving the report with nothing in its RecordSource
property.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Paul Mars" <(E-Mail Removed)> wrote in message
news:OB$(E-Mail Removed)...
> I have a form that has several different record sources. This form has a

btn
> to open a report. This report has the same record source as the current

form
> instance. I do this with:
>
> Private Sub Report_Open(Cancel As Integer
> Me.RecordSource = Forms!MainData.RecordSource
>
> Now I just filtered the form instance. I thought I could then apply this
> filter to the report by adding:
>
> Me.Filter = Forms!MainData.Filter to the above code, but this does not
> apply the open form filter to the report. How can I do this?
>
> Thanks,
> Paul



 
Reply With Quote
 
Paul Mars
Guest
Posts: n/a
 
      17th Apr 2004
thanks, that did it. Another question: Why did help not tell me this. I
looked up "Filter" and read all there was. Nothing about FilterOn.

Thanks again,
Paul

"Allen Browne" <(E-Mail Removed)> wrote in message
news:4080d783$0$16573$(E-Mail Removed)...
> Did you set FilterOn to true as well?
>
> Private Sub Report_Open(Cancel As Integer)
> With Forms!MainData
> Me.RecordSource = .RecordSource
> If .FilterOn Then
> Me.Filter = .Filter
> Me.FilterOn = True
> End If
> End With
> End Sub
>
> That should work unless the form's filter has been set by using the
> non-bound columns of your combos.
>
> (You might also try saving the report with nothing in its RecordSource
> property.)
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Paul Mars" <(E-Mail Removed)> wrote in message
> news:OB$(E-Mail Removed)...
> > I have a form that has several different record sources. This form has a

> btn
> > to open a report. This report has the same record source as the current

> form
> > instance. I do this with:
> >
> > Private Sub Report_Open(Cancel As Integer
> > Me.RecordSource = Forms!MainData.RecordSource
> >
> > Now I just filtered the form instance. I thought I could then apply this
> > filter to the report by adding:
> >
> > Me.Filter = Forms!MainData.Filter to the above code, but this does

not
> > apply the open form filter to the report. How can I do this?
> >
> > Thanks,
> > Paul

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter Form, Print Report based on Filter 2Blessed4Stress Microsoft Access Forms 1 2nd Jul 2009 11:50 PM
Resetting the form filter filter for a new report Frank Tempelman Microsoft Access Forms 4 16th Mar 2009 05:55 PM
Filter by Form...How can the Report Reflect the Filter? =?Utf-8?B?QnJ5YW4=?= Microsoft Access Forms 7 15th Aug 2007 02:29 PM
Filter report based on filter on form Henrootje Microsoft Access 1 19th Dec 2005 12:40 PM
Filter by Selection/Filter by Form Report Alan Microsoft Access 1 22nd Jul 2003 06:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:26 AM.