Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / March 2007

Tip: Looking for answers? Try searching our database.

Basing a report on a filtered form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TrevorJ - 06 Mar 2007 15:46 GMT
I have a form with multiple search boxes to filter on one or more different
fields on the form. When any of the search boxes are changed, I make up an
SQL statement and poke it at the record source of a subform on the main form
to produce the filtered results that I
want.(Me![frmSearchResults].Form.RecordSource = strSQL & strCriteria)
I then need to get a report printout of the recordset displayed. I cannot
realistically make a query based on the form fields as they do not
neccessarily all contain my search criteria. I have played around with
recordset.clone, and can count the records, but what I want to be able to do
is poke the recordset (How can I or otherwise) at a report as its
recordsource to produce the same data.
Can anyone please help?
Trevor
Marshall Barton - 06 Mar 2007 19:29 GMT
>I have a form with multiple search boxes to filter on one or more different
>fields on the form. When any of the search boxes are changed, I make up an
[quoted text clipped - 7 lines]
>is poke the recordset (How can I or otherwise) at a report as its
>recordsource to produce the same data.

If the report is based on the same (unfiltered) table/query
as the subform, then, in the command button that opens the
report, use the OpenReport method's WhereCondition argument
to filter the report to the criteria in your strCriteria
string.

Signature

Marsh
MVP [MS Access]

TrevorJ - 06 Mar 2007 20:57 GMT
Thanks Marsh. Worked a treat. Moved the declaration of strCriteria to the top
of the module, had to ditch the 'Order by ....' from the end of strCriteria
for the report, and tack it back on for the Sub form.
Thanks again
Trevor

> >I have a form with multiple search boxes to filter on one or more different
> >fields on the form. When any of the search boxes are changed, I make up an
[quoted text clipped - 13 lines]
> to filter the report to the criteria in your strCriteria
> string.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.