473,624 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Albert Kallal's QuantityOnHand - Speed Optimisation

I use the above function in queries for a number of forms and reports.
The reports take approx 20 seconds to open. There are only 100
product id's in tblProducts. My concern is that the time will
increase as products are added.

Any suggestions to speed it up?

TIA

David
Nov 13 '05 #1
13 1972

"David Mitchell" <da************ **@talk21.com> wrote in message
news:c3******** *************** ***@posting.goo gle.com...
I use the above function in queries for a number of forms and reports.
The reports take approx 20 seconds to open. There are only 100
product id's in tblProducts. My concern is that the time will
increase as products are added.

Any suggestions to speed it up?

Use MVP multi-purpose grease.

Nov 13 '05 #2
I don't see the "above function" you are referring to.

On 15 Sep 2004 15:04:25 -0700, da************* *@talk21.com (David Mitchell)
wrote:
I use the above function in queries for a number of forms and reports.
The reports take approx 20 seconds to open. There are only 100
product id's in tblProducts. My concern is that the time will
increase as products are added.

Any suggestions to speed it up?

TIA

David


Nov 13 '05 #3
erm!?! Perhaps the subject of my posting gives a small clue!

QuantityOnHand! !!!!!!

<g>
Steve Jorgensen <no****@nospam. nospam> wrote in message news:<e5******* *************** **********@4ax. com>...
I don't see the "above function" you are referring to.

On 15 Sep 2004 15:04:25 -0700, da************* *@talk21.com (David Mitchell)
wrote:
I use the above function in queries for a number of forms and reports.
The reports take approx 20 seconds to open. There are only 100
product id's in tblProducts. My concern is that the time will
increase as products are added.

Any suggestions to speed it up?

TIA

David

Nov 13 '05 #4

"David Mitchell" <da************ **@talk21.com> wrote in message
news:c3******** *************** ***@posting.goo gle.com...
erm!?! Perhaps the subject of my posting gives a small clue!

QuantityOnHand! !!!!!!

<g>


It is much better if you make it easier on those who are trying to help you
by including all the necessary information in the body of your post, so they
don't have to make a "connection " between the Subject and the Body.

I haven't used Albert's function, so I can't be of help. It's a rare
newsgroup post that will excite anyone to the point that they will search
out where to obtain some code and then try to puzzle out why it isn't
working for someone else. <WHEW>

Your best best is that Albert will see this and respond. He's a nice,
helpful person.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #5
"David Mitchell" <da************ **@talk21.com> wrote in message
news:c3******** *************** ***@posting.goo gle.com...
I use the above function in queries for a number of forms and reports.
The reports take approx 20 seconds to open. There are only 100
product id's in tblProducts. My concern is that the time will
increase as products are added.

Any suggestions to speed it up?


Ok, lets try some sample data, and see how well ms-access works here.

Lets assume 500 products in the product table. = 500 records

Lets assume that we had 5 stock taking days where we added stock to EACH
product 5 TIMES this year.
(so, each stock item was re-stocked 5 times during the year. Note that the
sample given design allows
for price changes as new stock arrives).

That now means that our Inventory table has 2500 records.

Lets also assume that each Inventory item has 50 orders in the invoices
(order details) table.

That now means our Orders Details table has 50 * 2500 = 125,000 records.

I just wrote some code to fill that database example of mine.

So, we got 125,000 detail records, and 2500 inventory items (or, 500
products
with each 5 stock days...the math here is the same!). So, you could assume
2500 products each with 50 orders (and each product only has had ONE stock
day).

Ok, 3 little loops later...and a bit code to generate the data for me. Ok,
here is the results ON A VERY SLOW 600MHz notebook:

Time to total up all of the in-stock records (that is running sql
statements to total all Inventory additions less all those 125,000 order
details.

That means the sql has to join up all records that belong to each
product..and
sum them.

1.4 seconds! is the TOTAL time it takes on my poor 600mhz computer.

So, if I base a report on the above sql query (and sub-queries), the is a
"slight" delay, but the report loads in less then 2 seconds. Mind you, we
on,ly are dealing with 125,000 detail records being joined here. This is
NOT a large table for ms-access.

The report loads in less then 2 seconds, and the bottom right corner shows
17 pages of output (so, we actually are also including the rendering of the
report here)..

To me, this just shows the BLISTERING speed of the JET engine. I in fact
find it is usually MUCH faster then sql server.

I have posted a copy of the above database with the sample data here:
http://www.attcanada.net/~kallal.msn.../msaccess.html

I am guessing, but likely you are dong some sql joins on fields that ARE NOT
indexed. it is critical that the ProductID fields are indexed. As you can
see, a file that joins 125, 000 detail records to 2500 inventory records
takes less then two seconds on a very old and slow computer. With
only 100 items as you mention, there should be NO delay in generating
that report.

Try running the query that I have in
the above..the 125,000 query should near instant for you....

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl************* ****@msn.com
http://www.attcanada.net/~kallal.msn

Nov 13 '05 #6
Have just downloaded and will take a look over the weekend. Thank you
for your time and effort.

David
Nov 13 '05 #7
Just had a quick look and cannot see any mention of your function
Quantity on Hand.

You are correct regarding the speed, the query executes in less than
0.8 of a second.

My query utilises your function:- Stock: OnHand([ProductID])

Is it because I am using a function in a query?
Nov 13 '05 #8
Yes, calling a function is expensive in terms of processing.

So, for a form that displays a particular (single) product, the function is
acceptable in performance. However, using a function in a report, or
anything that has to deal with a lot of records, then you cannot afford to
call the function "over and over".
So, just take a look at the query called

qryOnHand.

You can see in the query builder how the function was replaced with some sql
to do the same thing.

I simply put:

TotalAddStock: (select sum(UnitsAdd) from inventory where ProductID =
Products.Produc tID)

and:

TotalSoldStock: (select sum(Quantity) from OrderDetails where ProductID =
Products.Produc tID)

The above two columns thus total stock added, and stock sold.

And, then in the query builder I added:

InStock: (TotalAddSTock-TotalSoldStock)

So, you can still use the query builder here, but I did have to type in some
sql directly. And, really, the above is actaully a LOT simpler then using
code.
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl************* ****@msn.com
http://www.attcanada.net/~kallal.msn
Nov 13 '05 #9
I'm assuming David Mitchell is referring to part of Albert's web site?
Could I ask if Albert or David would provide a URL? Or, if it's in
reference to an earlier post on cdma, could one of you tell me the
subject title and I'll check my news server or google it?

Thanks.

--
Tim - http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #10

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

Similar topics

23
2627
by: Mark Dickinson | last post by:
I have a simple 192-line Python script that begins with the line: dummy0 = 47 The script runs in less than 2.5 seconds. The variable dummy0 is never referenced again, directly or indirectly, by the rest of the script. Here's the surprise: if I remove or comment out this first line, the script takes more than 15 seconds to run. So it appears that adding a redundant line produces a spectacular six-fold increase in speed!
2
1707
by: Remco Groot Beumer | last post by:
Hello, I'm building a database in which is a form with the following elements: - 19 textfields - 6 comboboxes (with small amount of data, mostly below 10 records) - 1 listbox - 1 subform (also relative small) - 6 lines (boxes) - 1 picturebox (no picture in the database, but it shows a picture on the local disk)
5
1247
by: Steve | last post by:
Hi I have developed an app that has a mde file that contains the application and a mdb file that contains the data. When started the app links all tables in the mdb file into the mde file and when the app is closed all links are removed. The mdb file resides on a server. The application was developed using Access 2002. The problem is as follows :
60
10129
by: Neil | last post by:
I have a situation with an ODBC linked view in an Access 2000 MDB with a SQL 7 back end. The view is scrolling very slowly. However, if I open the view in an ADP file, it scrolls quickly. I needed to use an ODBC link for the view because it needs to be editable. Otherwise, I would have used a pass-through query. In previous discussions about using an MDB file vs. an ADP file as a front end for SQL Server, the impression I got was that...
2
1302
by: Ulcom | last post by:
Hi Right now I have a client with the following: They have a program (lets call it program A) containing around 20 tables and queries and forms... This program is on a server. The company have 8 computers and each computer have an access to the server via a shortcup that point to the mdb file. Everything is running fine I have make some change to a copy of this file. This program has no tables, but is linked to the tables of the...
2
2754
by: jphelan | last post by:
Ever since I successfully applied some techniques for increasing the speed of my 17 meg. Application; it has only made me hunger for more. First, let me list what I have done so far: 1. Split the application and database into front and back-ends, 2. Increased the load-time of my application by "pre-loading my heaviest forms when the database is initially opened, 3. When forms do open, under, "Filter Lookup" I use, "Never", 4. I set...
4
1281
by: travolta003 | last post by:
Speed up your system, repair installation, tweak your registry base with powerful tips and tricks collected all over the internet... http://windowsxpsp2pro.blogspot.com/
9
4086
by: anon.asdf | last post by:
In terms of efficieny: Is it better to use multiple putchar()'s after one another as one gets to new char's OR is it better to collect the characters to a char-array first, and then use puts() to print to screen ????
18
1898
by: maxhugen | last post by:
I have an Access app (split into FE and BE) running for some years, that is now also being used in a second office, connected by a WAN. This office has network problems, as it's over-utilized (97% according to one IT guy!!). I'm looking into converting the MDB app into an ADP with a SQL Server backend. To justify the costs involved, I'm trying to get a feel for what spped improvements might reasonably be expected. After a lot of...
0
8238
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8624
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8336
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7164
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6111
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1485
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.