Solved

How to disable or change the report Sort option in Access 2007 using vba

Posted on 2013-05-15
3
520 Views
Last Modified: 2013-05-16
I have a report where under the Group and sorting options I have only one sort option selected. No grouping.  I want to use this report for another means and need to be able to either remove that Sort in the report open event or at least change the field that the report is sorting on.  I can do this for Groupings, but cannot find any code for a sort only. the OrderBy has no effect. Trying to access GroupLevel(0) returns an error. Any ideas on how I can change this sort using vba?
0
Comment
Question by:BradleyCleveland
3 Comments
 
LVL 3

Accepted Solution

by:
pjevin earned 500 total points
Comment Utility
You could set the recordsource in the on open event and put your ordering in the sql statement.
Dim SQL as string
SQL = //put your sql query here
Me.RecordSource = SQL
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
<the OrderBy has no effect.>
Are you quite sure you are using it correctly?
Can you post the code you were trying...

In order for me.Orderby to work, it must be followed by:
    Me.OrderByOn = True
....and note that the report must be opened in "Print Preview" explicitly for this to work.

This has worked fine for me for years...

basic sample attached
Database241.mdb
0
 
LVL 1

Author Closing Comment

by:BradleyCleveland
Comment Utility
This looks like it will work.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now