A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Using filtered form data as record source for report



 
 
Thread Tools Display Modes
  #1  
Old April 12th, 2010, 11:21 PM posted to microsoft.public.access.reports
Ken Warthen[_2_]
external usenet poster
 
Posts: 39
Default Using filtered form data as record source for report

I have a split form in an Access 2007 database where the data grid shows the
records from a query. The user can filter any combination of fields from the
the drop down headers. I have a command button above the data grid that
opens a report with the same query as its record source. I'm trying to
figure out how to pass the filtered data to the report so it will show only
those records that the user is seeing in the data grid of the split form.
Any help with this issue will be greatly appreciated.

Ken
  #2  
Old April 13th, 2010, 01:04 AM posted to microsoft.public.access.reports
Allen Browne
external usenet poster
 
Posts: 11,706
Default Using filtered form data as record source for report

You may be able to pass the Filter of your form as the WhereCondition of the
report.

The code for your button would look like this:
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
DoCmd.OpenReport "Report1", acViewPreview, , strWhere

It may be a bit more complex if you have combo boxes where the bound column
is not the display column, or multi-valued fields.

--
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.


"Ken Warthen" wrote in message
...
I have a split form in an Access 2007 database where the data grid shows
the
records from a query. The user can filter any combination of fields from
the
the drop down headers. I have a command button above the data grid that
opens a report with the same query as its record source. I'm trying to
figure out how to pass the filtered data to the report so it will show
only
those records that the user is seeing in the data grid of the split form.
Any help with this issue will be greatly appreciated.

Ken


  #3  
Old April 13th, 2010, 11:09 AM posted to microsoft.public.access.reports
Ken Warthen[_2_]
external usenet poster
 
Posts: 39
Default Using filtered form data as record source for report

Allen,

Thanks so much for the help, your suggestion seems to work perfectly. I
have a multi-valued field displayed on the split form and your code seems to
be able to pass any filtering of that field to the report without issue.

Thanks again,

Ken

"Allen Browne" wrote:

You may be able to pass the Filter of your form as the WhereCondition of the
report.

The code for your button would look like this:
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
DoCmd.OpenReport "Report1", acViewPreview, , strWhere

It may be a bit more complex if you have combo boxes where the bound column
is not the display column, or multi-valued fields.

--
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.


"Ken Warthen" wrote in message
...
I have a split form in an Access 2007 database where the data grid shows
the
records from a query. The user can filter any combination of fields from
the
the drop down headers. I have a command button above the data grid that
opens a report with the same query as its record source. I'm trying to
figure out how to pass the filtered data to the report so it will show
only
those records that the user is seeing in the data grid of the split form.
Any help with this issue will be greatly appreciated.

Ken


.

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:21 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.