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  

Report sorting when selection criteria via form



 
 
Thread Tools Display Modes
  #1  
Old October 15th, 2007, 06:43 PM posted to microsoft.public.access.reports
Dennis
external usenet poster
 
Posts: 1,222
Default Report sorting when selection criteria via form

In Access2002, I've opened a report ("DoComd.OpenReport") using the selection
criteria as part of the open command (not a FILTER but as the WHERE). What I
need to do now is add a way to sort the report by a user-selected set of
fields. I have three fields on the form, and the user can enter a "1", a "2"
or a "3" in the fields to denote what order they want the report sorted in.
So we can have up to three sort criteria, and various arrangements.

Now, how can I pass the sort criteria to the report using that same DOCMD
syntax. I attempted to add the "ORDER BY" string I built to the end of the
other string, but it won't work. Any thoughts or ideads would be most welcome.

Thanks!
  #2  
Old October 15th, 2007, 08:05 PM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Report sorting when selection criteria via form

IMHO don't use the Order By property as it is always over-ridden by the
sorting and grouping levels. You can manipulate the sorting and grouping
using the solution found at Allen Browne's web site
http://www.allenbrowne.com/ser-33.html.

FYI: the WHERE CONDITION of the DoCmd.OpenReport method automatically sets
the FILTER property. This is a very good method for applying a filter.

--
Duane Hookom
Microsoft Access MVP


"Dennis" wrote:

In Access2002, I've opened a report ("DoComd.OpenReport") using the selection
criteria as part of the open command (not a FILTER but as the WHERE). What I
need to do now is add a way to sort the report by a user-selected set of
fields. I have three fields on the form, and the user can enter a "1", a "2"
or a "3" in the fields to denote what order they want the report sorted in.
So we can have up to three sort criteria, and various arrangements.

Now, how can I pass the sort criteria to the report using that same DOCMD
syntax. I attempted to add the "ORDER BY" string I built to the end of the
other string, but it won't work. Any thoughts or ideads would be most welcome.

Thanks!

 




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 08:42 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.