Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-05-15
3
Medium Priority
?
579 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
pjevin earned 2000 total points
ID: 39169608
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
ID: 39170450
<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
ID: 39172519
This looks like it will work.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

618 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