Open report with same info as a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!

I have an annoying problem which I cannot solve for some reason... My Access
skills are still at a novice/medium level.

I have a form (frmEvaluationList) containing header, detail and footer
sections, and in the detail I display the result of a query. On the header I
have several buttons to set the form's OrderBy -parameter to sort on a
specific column and ASC or DESC. When the user is satisfied with the way the
data is sorted, he should be able to print it. I figured a report would be
the choise to accomplish this, right?

When I build the report (rptEvaluationPlot) with the wizard, I base it on
the same query as the form above. I realize that the sort settings from the
form isn´t attachet to the query, but how is it possible to make the report
fetch the current OrderBy-settings from the form? (The idea is to have a
"print report"-button on the form when done.)

Any help would be greatly appreciated!
Thanks, Peter
 
Thanks Duane, I believe this should work just great. Just one more question
on the subject; how do I create different grouplevels like the ones in Allen
Browne's example?

Peter


"Duane Hookom" skrev:
 
Open the report in design view and then open the Sorting And Grouping
dialog. You can add the levels there.
 
Hi again,

I've been trying over and over again. Unforunately, I wasn't able to get
your solution to work Duane. There's obviously some piece I never understood
fully. :) However, I managed to get my report to sort as I wanted it to. I
removed all "Sorting and grouping" properties from the View-menu. In the
On-Open code section, I wrote a few lines like this:

Select Case Forms!frmEvaluate!txtSortCol & Forms!frmEvaluate!txtSortOrder
Case "Paramname ASC"
Me.RecordSource = "SELECT * FROM [qryEvaluateFinal] ORDER BY
[Paramname], [additional sort column]"
Case "StdDev DESC"
|
|
|
etc.

This seems to generate a correct result. If there are any objections why
this is a bad method, please don't hesitate to let me know!

Thanks for your help Duane, it was most appreciated!

Peter the Swede

"Duane Hookom" skrev:
 
I wouldn't trust your method. Apparently you did find the sorting and
grouping levels since you suggested you "removed" them. I would add as many
back as you need to define for your report and then use the code from
Allen's site that dynamically sets the control sources of these levels.

--
Duane Hookom
MS Access MVP


Peter the Swede said:
Hi again,

I've been trying over and over again. Unforunately, I wasn't able to get
your solution to work Duane. There's obviously some piece I never
understood
fully. :) However, I managed to get my report to sort as I wanted it to. I
removed all "Sorting and grouping" properties from the View-menu. In the
On-Open code section, I wrote a few lines like this:

Select Case Forms!frmEvaluate!txtSortCol &
Forms!frmEvaluate!txtSortOrder
Case "Paramname ASC"
Me.RecordSource = "SELECT * FROM [qryEvaluateFinal] ORDER BY
[Paramname], [additional sort column]"
Case "StdDev DESC"
|
|
|
etc.

This seems to generate a correct result. If there are any objections why
this is a bad method, please don't hesitate to let me know!

Thanks for your help Duane, it was most appreciated!

Peter the Swede

"Duane Hookom" skrev:
Open the report in design view and then open the Sorting And Grouping
dialog. You can add the levels there.

--
Duane Hookom
MS Access MVP


message
 
Back
Top