Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert MSAccess Form RecordsetClone to report recordsource?

Status
Not open for further replies.

lldevel

Programmer
Nov 11, 2001
17
0
0
US
I need to take the current recordset of a datasheet form (after user has filtered, sorted, etc.) and run a report from the form's recordset. After filters/sorts are applied, the only property that I believe contains the filtered/sorted recordset is derived from the recordsetclone method. However, I am not able to convert that recordset into a recordsource for the report. Any suggestions appreciated.
 
I suggest you to try the following way:

Base your report on the same RecordSource (Table or Request) as your form.

In the ReportOpen event procedure of your report, put the following statements:
>>Me.Filter=Forms!myform.Filter
>>Me.FilterOn=True
>>Me.Orderby=Forms!myform.OrderBy
>>Me.OrderBy=True
(Of course, replace "myform" with the actual name of your form)

Once your filter and sort are ok in the form, launch the report (DoCmd.Report Open "MyReport") without any Filter or Whereclause, and DON'T close your form.
I hope you'll be close to the result you look for.


 
Lozere,

Thanks for the tip, worked great. My form is in memory only (dynamic form), so I took your example, and used variables to pass in the 3 necessary parameters and had report on_open behave accordingly. I had to have the report also toggle the Reports OrderByOn & FilterOn properties based on the form's associated properties, since the form and report didn't always clear the OrderBy & Filter fields, it just turned the flags on/off when filters/sorts were added or removed.

Thanks much.

L
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top