473,396 Members | 2,061 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,396 software developers and data experts.

Speeding Up Reports

I am running a complex query using about 25 criteria that are entered
on a query form. If any individual criteria isn't required its field is
left as "*" on the form. When I run the query the first time the
results take about 3 or 4 seconds to appear on a "Query Results" form.
Subsequent queries using either the same or different criteria give a
result in less than 1 second.

The "Query Results" form has a button to open an equally complex report
(about 30 fields) based on the same query as the form. The report takes
about 20 seconds to open in print preview each time. What is Access
actually doing when a report is being generated and why will the query
results display on a form so much more quickly than on a report?

Is there anything I can do, other than simplify the query, to reduce
the time that the report takes to open?

Thanks in advance.

Nov 13 '05 #1
2 1606
What Access is doing is to rerun queries into your original query, based on
the sorting and grouping that it must perform within the report.

Instead of including all those criteria in the original query when you may
only need to use a few of the 25 or so, could you leave them out of the
query? Instead, generate a WhereCondition for your OpenReport, based only on
the text boxes that have a value. This should dramatically reduce the number
of criteria that Access has to evaluate to get the report open, and it may
even facilitate the use of indexes (depending on the specifics).

The example below shows how to build up a WhereCondition string from only
the text boxes where the user entered a value. It is coded in such as way as
to make it easy to add as many conditions as you need.

---------------code starts------------------
Dim strWhere As String
Dim lngLen As Long

If Not IsNull(Me.txtFilterCity) Then 'Text field example.
strWhere = strWhere & "([City] = """ & Me.txtFilterCity & """) AND "
End If

If Not IsNull(Me.txtFilterAmount) Then 'Number field example
strWhere = strWhere & "([Amount] = " & Me.txtFilterAmount & ") AND "
End If

'etc for other boxes.

'Now cut off the trailing " AND ".
lngLen = Len(strWhere) - 5
If lngLen > 0 Then
strWhere = Left$(strWhere, lngLen)
End If

DoCmd.OpenReport "Report1", acViewPreview, , strWhere
---------------code ends------------------
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Wayne" <cq*******@volcanomail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I am running a complex query using about 25 criteria that are entered
on a query form. If any individual criteria isn't required its field is
left as "*" on the form. When I run the query the first time the
results take about 3 or 4 seconds to appear on a "Query Results" form.
Subsequent queries using either the same or different criteria give a
result in less than 1 second.

The "Query Results" form has a button to open an equally complex report
(about 30 fields) based on the same query as the form. The report takes
about 20 seconds to open in print preview each time. What is Access
actually doing when a report is being generated and why will the query
results display on a form so much more quickly than on a report?

Is there anything I can do, other than simplify the query, to reduce
the time that the report takes to open?

Thanks in advance.

Nov 13 '05 #2
Thanks Allen, I'll give this a try.

Nov 13 '05 #3

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

Similar topics

4
by: Snyke | last post by:
Hi. I have a command line script which works really fine, the only problem is that it take *really* long for the first output to be printed on screen. Since I also get some HTTP headers I'm...
5
by: BStorm | last post by:
I have a transaction log file where the DataSet table's Description column is actually delimited into "subcolumns" based upon the transaction id. I would like to parse these into separate fields...
12
by: dvumani | last post by:
I have C code which computes the row sums of a matrix, divide each element of each row with the row sum and then compute the column sum of the resulting matrix. Is there a way I can speed up the...
9
by: mfyahya | last post by:
Hi, I'm new to databases :) I need help speeding up select queries on my data which are currently taking 4-5 seconds. I set up a single large table of coordinates data with an index on the fields...
2
by: Robert Wilkens | last post by:
Ok... This may be the wrong forum, but it's the first place I'm trying. I'm new to C# and just implemented the 3-tier Distributed application from Chapter 1 (the first walkthrough) in the...
2
by: OHM | last post by:
I was wondering about this topic and although I accept that different situations call for different solutions, but wondered are there any other solutions and whether has anyone carried out a...
2
by: B.Newman | last post by:
I've got some VB.NET code that *should* get a list of reports from an Access MDB and populate a list box with them. It doesn't detect any of the reports at all. oAccess.Reports.Count comes up as...
5
by: RobinAG | last post by:
Hello, I just split my database into front and back end. My front end users are experiencing really slow opening of forms. I've searched online for help speeding up forms, but I'm not sure what...
10
by: ags5406 | last post by:
I've created an application that downloads data daily from a secure web site and stores that data in an Access database. Then there are different options for allowing the user to do keyword and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.