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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Remove Sort when Parameter 1

Status
Not open for further replies.

snip6969

Technical User
Sep 22, 2002
16
CA
Hello,

I have a query/report that require paramaters. The found data for the paramaters entered need to be printed in order of the parameter entry. Access keeps sorting these based on the parameter entry value. For example: The parameter is [Fruit1] or [Fruit2] or [Fruit3]. For [Fruit1] I want to enter Oranges, [Fruit2] I want to enter Apples, and [Fruit3] I want to enter Grapes. On the report I want it to print Oranges first Apples second, and then Grapes third. Access keeps sorting it Apple, Grapes, Oranges. Please help.
 
Let's see your code for showing the parameters on that report...
 
In the recordsource of the report, have actual columns for each of your parameters...in this case Fruit1, Fruit2, and Fruit3. Sort each of these columns ascending.

Kind of confusing...you'd still need to have each of your parameters in the criteria portion of whatever field you have them in, but also have them as extra columns. Hope that helps.

Kevin
 
Kevin,

Thanks for the reply. Could you walk me through it? The field name is Fruit. How do I make a column for each of my parameters and then include those columns in my Fruit field criteria.
 
I just tried doing the column thing and it works for the query, but its the report that keeps sorting it. Also note that I am using grouping on the Fruit name. If I don't group on the fruit name on the report it works fine. Is it possible to group on the fruit name but not sort it?
 
I might have been drunk when I responded to you the first time because I don't think my solution works at all...or maybe I'm just forgetting how.

Anyway...for the report...

I don't know of a real easy way for this, but I might be forgetting something. This way will work though:

In your recordsource for the report add a new field called "SortOrder" and use this formula for the value of the field:

SortOrder: iif([FruitFieldName]=[fruit1],1,iif([FruitFieldName]=[fruit2],2,3))

Then in your report you would have a grouping for the SortOrder field before you have the grouping for Fruit Name.

Hope that helps more than my last post...
 
GoDawgs your post was perfect! The report sorts correctly now. Good thinking!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top