473,395 Members | 1,616 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Docmd.openreport

I don't seem to be able to get opening a report and sortin the rcords right.
I an open the report, limited to a range of my choosing. So, for example
the code below opens my report and limits it to the dates required.
DoCmd.OpenReport stDocName, acPreview, "[NegBehave].[NegDate] Between #" &
Format(startdate, "DD MMM YYYY") _
& "# and #" & Format(enddate, "DD MMM YYYY") & "#"

The start date and end date are chosen by the user.

All is fine, but I wan to offer the user the opportunity to sort and print
in any order. I feel I ought to be able to tack on the end of this Orber By
FieldX, but nothing seem to work.
Nov 13 '05 #1
1 5045
"JohnM" <jo**@jmawer.demon.co.uk> wrote in message
news:di*******************@news.demon.co.uk...
I don't seem to be able to get opening a report and sortin the rcords right. I an open the report, limited to a range of my choosing. So, for example
the code below opens my report and limits it to the dates required.
DoCmd.OpenReport stDocName, acPreview, "[NegBehave].[NegDate] Between #" &
Format(startdate, "DD MMM YYYY") _
& "# and #" & Format(enddate, "DD MMM YYYY") & "#"

The start date and end date are chosen by the user.

All is fine, but I wan to offer the user the opportunity to sort and print
in any order. I feel I ought to be able to tack on the end of this Orber By FieldX, but nothing seem to work.

In the OPEN event of your report put code similar to this:
(CAUTION: air code)

Select Case Forms!MyForm!SortOrder
Case 1
Me.OrderBy = "Date1, Account, Lname"
Me.OrderByOn = True
Case 2
Me.OrderBy = "Account, Date1, Lname"
Me.OrderByOn = True
Case 3
Me.OrderBy = "Lname, Account, Date1"
Me.OrderByOn = True
End Select

Good Luck,
Fred Zuckerman
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andrew | last post by:
Hi All: I am using Access2000 and I find that the command to open an Access report in preview mode is very slow: DoCmd.OpenReport rptABC, acViewPreview, "", "" The scenario is this: - The...
2
by: Jonathan Goldman | last post by:
Hi- I have a relatively simple report that I open in an Access '97 VBA procedure, using the Docmd.OpenReport "rptName", acViewNormal syntax. The problem is that doing this usually crashes...
1
by: Filips Benoit | last post by:
Dear All, DoCmd.OpenReport RPT_TEST, A_PREVIEW, QueryAsFilter doesn't work correctly in A97 but works OK in A2K. Is this a bug for A97 ? Filip
1
by: LoopyNZ | last post by:
Hi there, I've converted an Access 97 front end to Access 2000, but when I try to run a VBA DoCmd.OpenReport (e.g. DoCmd.OpenReport "rpt_programme_listing") line, Access completely crashes...
3
by: news.onet.pl | last post by:
Hello! I have a question concerning to open the reports. I know that DoCmd.OpenReport is a obsolete form of opening the reports, but how to implement opening reports in VB using another VB code?...
3
by: enough2Bdangerous | last post by:
access runtime error 3011 on docmd.openreport -------------------------------------------------------------------------------- Access database (file format 2002-2003) generates reports with...
4
by: Simon | last post by:
Dear reader, The syntax for Docmd.OpenReport is: OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs) Example The following example prints Sales Report while...
4
by: robtyketto | last post by:
Greetings, I originally used a button on a from created via the button wizard (access 2007) to run my report which was based on a query. Since I wanted to add some validation I removed the...
5
by: scottbouley | last post by:
Maybe I'm missing something or perhaps there's another way to do this. I'm trying to allow the user to preview and print an invoice as they are exiting from the New Sale form. However, the preview...
4
by: gazza10001 | last post by:
Hi i hope you can help my company uses access and has modified for its needs usually what happens is you serach for the invoice by its number and then it brings all the information up such as...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.