By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,505 Members | 1,549 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,505 IT Pros & Developers. It's quick & easy.

Alternate sorting for Access report

P: n/a
I have a report whose record source is a query. The query includes an
ORDER BY clause that sorts on a particular set of columns. I would
like to be able to run the same report with the same input data, sorted
on a different set of columns. Aside from copying (^C, ^V) the report
and changing the Record Source property in the new copy to another
query, is there an elegant way to accomplish this?

Thanks

Rick

Apr 25 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Look at QueryDef in the Help file. You use a single query but change the
query's SQL programatically.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1175 users have come to me from the newsgroups requesting help
re******@pcdatasheet.com
<nn****@optonline.net> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
I have a report whose record source is a query. The query includes an
ORDER BY clause that sorts on a particular set of columns. I would
like to be able to run the same report with the same input data, sorted
on a different set of columns. Aside from copying (^C, ^V) the report
and changing the Record Source property in the new copy to another
query, is there an elegant way to accomplish this?

Thanks

Rick

Apr 25 '06 #2

P: n/a
nn****@optonline.net wrote in message
<11**********************@i39g2000cwa.googlegroups .com> :
I have a report whose record source is a query. The query includes
an ORDER BY clause that sorts on a particular set of columns. I
would like to be able to run the same report with the same input
data, sorted on a different set of columns. Aside from copying (^C,
^V) the report and changing the Record Source property in the new
copy to another query, is there an elegant way to accomplish this?

Thanks

Rick


My opinion is to never rely on other methods of sorting than the
sorting
and grouping thingie within the report itself. Any sorting and qrouping
in the recorsource, is usually ignored.

Check this article at Allen Brownes, for how to manipulate it
programatically
http://allenbrowne.com/ser-33.html

--
Roy-Vidar
Apr 25 '06 #3

P: n/a
"PC Datasheet" <fa***@email.com> wrote in message
news:oA*****************@newsread3.news.atl.earthl ink.net...
Look at QueryDef in the Help file. You use a single query but change the
query's SQL programatically.


<sigh>

Yet another wrong answer just to plug your "resource". A report's sorting
and grouping will always override that of the bound data source. The
correct answer is to code the grouping and sorting in the report's open
event.

Keith.
www.keithwilby.com
Apr 25 '06 #4

P: n/a


"PC Datasheet" <fa***@email.com> wrote in message
news:oA*****************@newsread3.news.atl.earthl ink.net...
Look at QueryDef in the Help file. You use a single query but change the
query's SQL programatically.


This is a useful contribution? Why not tell him to look at the Access
documentation?

John... Visio MVP
Apr 25 '06 #5

P: n/a

"PC Datasheet" <fa***@email.com> schreef in bericht news:oA*****************@newsread3.news.atl.earthl ink.net...
Look at QueryDef in the Help file. You use a single query but change the
query's SQL programatically.
This is not a bright answer.
With reports you can't rely on Access using the Order By from the recordset ...
--
-- PC Datasheet
Your Resource For Help With Access, Excel And Word Applications 'Resource ????
Over 1175 users have come to me from the newsgroups requesting help '1175 users ????
re******@pcdatasheet.com


--
To Steve:
No-one wants your advertising/job hunting here!
Over 750 !! users from the newsgroups have visited the website to read what kind of a 'resource' you are... (rapidly increasing..)

To the original poster:
Most people here have a common belief that the newsgroups are for *free exchange of information*.
But Steve is a notorious job hunter in these groups, always trying to sell his services.
And he is known here as a shameless liar with no ethics at all.

Before you intend to do business with him look at:
http://home.tiscali.nl/arracom/whoissteve.html

Arno R
Apr 25 '06 #6

P: n/a
Thank you all for your quick and insightful replies. The app in its
present state has a form that kicks off the report. On the form I'd
like to have two command buttons, each invoking the same report but
each with a different sorting scheme. If I ditch the query and use the
Order By property of the report instead, somehow the form must advise
the report how to configure that property to sort in one of the two
schemes. I figure that would happen in VBA code, but how exactly?
Should the form directly manipulate the property object in the report?
Or should the Open event in the report call back to the form to get the
sorting specs?

Thanks again

Apr 25 '06 #7

P: n/a
> Should the form directly manipulate the property object in the report?
Or should the Open event in the report call back to the form to get the
sorting specs?


The latter. The report needs to check a value on your form.
If you *need* the two command buttons on your form, you can set a (hidden) value in an optiongroup or similar.
You could also only use an optiongroup next to a single command button.

Check out the link that Roy gave you in this thread.
http://allenbrowne.com/ser-33.html

Arno R

Apr 25 '06 #8

P: n/a
nn****@optonline.net wrote in
news:11**********************@u72g2000cwu.googlegr oups.com:
Thank you all for your quick and insightful replies. The app in
its present state has a form that kicks off the report. On the
form I'd like to have two command buttons, each invoking the same
report but each with a different sorting scheme. If I ditch the
query and use the Order By property of the report instead, somehow
the form must advise the report how to configure that property to
sort in one of the two schemes. I figure that would happen in VBA
code, but how exactly? Should the form directly manipulate the
property object in the report? Or should the Open event in the
report call back to the form to get the sorting specs?


The latter is the way to do it. Open the form as a dialog in the
report's OnOpen event.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Apr 25 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.