Question

What are and how do I make Stored Queries

Asked by: deluk20


Ok, I seemed to have missed something here.

I have create a Database and split it between Tables and all other objects. The tables is sitting on a Network, with the other one located on User PC's.

Most of it seems ok apart from one form. This form contains a lot of indivual objects (text boxes and a lot of drop down combo boxes, and also a tab control). When this form opens it takes a little while to open and display the objects.

Ready through on the next one option was to disable the auto correct (done), another was stating:

To increase performance of form and drop down list loading, use stored queries for your record sources because they have already been optimized by Access. Note: the Access form wizard will create Select SQL statements for record sources, and these are not optimum.

What and how do I do this? I've never heard of stored queries. I have about 30 drop down lists.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-11-02 at 08:02:19ID24864010
Tags

MS Access 2003

Topics

Access Architecture/Design

,

Access Forms

,

Access Coding/Macros

Participating Experts
4
Points
500
Comments
11

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Optimum speed
    Hi all, I would like to know how to achieve maximum/optimum speed with the follwing devices. 1. A Samsung CD-ROM (CD Master 52E, Model SC-152C) 2. A Samsung Hard Drive VG34323A (4.32 GB) 3. A Samsung Hard Drive SP0802N (80 GB) - Ultra ATA 133 - 7200 RPM Please tell me how ...
  2. Help with query optimization
    I have got a huge nested query that takes a very long time to execute. Below is the execution plan. Could someone please help me optimize it. I have tried using various indexes, but not very successful. I have here removed them all, apart from PKs. --------------- [ start ] ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: peter57rPosted on 2009-11-02 at 08:27:35ID: 25720801

Stored queries  are just normal select queries that you create through the query grid. ( I use 'saved' queries rather than 'stored' queries but it's neither here nor there).
If you go into the rowsource of a dropdown list and click the build button (...) to the right, you will be dropped into the query grid.You can then save the query and give it a name. WHen you close it you will be asked if you want to update the rowsource and you can say yes.

However, I don't imagine that doing this is going to sort out your slow load times.


 

by: INHOUSERESPosted on 2009-11-02 at 09:05:58ID: 25721207

firstly you should look at your network setup. If the tables are in another office wirelessly linked... you will get poor performance.
Cables are much better for this type of thing.

I'd also suggest a SQL server option if it's available.

Another option (if it's possible for you) is to have the system copy some records/tables locally on startup, then when the system closes, sync up the changes.
This will cause issues if you users update the same record at the same time, but would speed everything up.

A final option is to have users download their frontend everytime they open it up. This can be achieved by a shortcut to a batch on the server instead of the MDB. This means that any tables with data that doesn't change often can be stored locally rather than on a server, with no issues of syncing. If these tables do change then they will just need to restart the database again. See below the code to stick in a .bat file:

@Echo off
Color 4E
Title Database is Now Updating to a NEW Version, Please Wait.....
@Echo on 

@Echo Please wait while database updates to a NEW version................... 

COPY "X:\databases\database.mdb" "C:\databases\"
@Echo Copying of database ::::: COMPLETE 
Start msaccess.EXE "C:\database\database.mdb"
@echo On

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:

Select allOpen in new window

 

by: MikeToolePosted on 2009-11-02 at 10:00:36ID: 25721771

Access tries its best to optimise performance in a frontend/backend design but needs some help and understanding from the developer.
The Access back-end database is not a Server, that is it doesn't do any record selection, the SQL logic is performed in the front-end. This is different to SQL Server, Oracle etc. where the server processes the SQL logic and returns only the selected results. The Access front end will make use of any indexes there are in order to reduce the amount of data traffic over the network, but if there is a Where clause on a field without an Index the front-end has to retrieve every record to check the criteria. If the tables are large this can lead to a significant delay in execution.
Examine the data source for all the controls on the form and check the where clauses for unidexed fields on large tables.

 

by: boag2000Posted on 2009-11-02 at 13:19:32ID: 25723860

As you can see, troubleshooting a "Slow Performance" issue is a broad topic, as this can be caused by many compounding considerations...

But I am leaning towards Pete's theory, that if you have 30 comboboxes on one form, the load time may never truly be "Fast".

First, just having the tables on a Server my not be enough.
Is this a "SQL Server"?

Second, if the server is located a Physically a great distance form the front ends, then the network: Specs, speed, Performance, Topology, technology, ...ect, all come into play.

Finally if all 30 (Which is quite a lot for one form) have "Hundreds" of items to display, then again, I am not sure that this will ever be "Fast".

Can I ask what the purpose of this form is?

Thanks

JeffCoachman

 

by: deluk20Posted on 2009-11-03 at 01:47:59ID: 25727329

Thank you all for your responses.

I have spoken with the client, and they have allowed that as these drop downs won't change that often they can be left on the front end, and when they do change then they will have to update the users version (which I have simplified by using a batch file).

Alas, an SQL Server in this instance is out of the question - the Clients 'must have'. I had warned them that an Access Database is not the best program to use, but they insisted. As they are a small company that keeps being bought by others, they just want the ability to 'pick-up' their data and take it somewhere else without having to pay $000's for servers.

The drop downs contain things like, Contract In, Contract Out etc, but they relate to very long sentences that are exported out to produce a Mail Merge Document in word.

 

by: peter57rPosted on 2009-11-03 at 02:07:18ID: 25727418

If you are currently operating in a 'normal' way whereby you open the form to use it and close uit when finshed, you might want to consider a different approach.

Open the form hidden as soon as the database opens.
Then anywhere you have a button/menu to 'open' the form, just make it visible, and anywhere you close the form, make it hidden again.

 

by: boag2000Posted on 2009-11-03 at 17:55:55ID: 25735747

Updating the comboboxes is not what I was referring to.

It is the sheer number of comboboxes.
Again, what are all of these comboboxes doing?

The concern is that all 30 of these comboboxes must load all of there lists.
This may be a big contributor to the slowness.
Again, especially if they each contain lots of values.

 

by: boag2000Posted on 2009-11-03 at 18:29:43ID: 25735896

^ so what I am trying to say is that with 30 comboboxes, each loading, for example, 100 items, this means that 3000 rows of data must be loaded.

Meaning that, perhaps it may not make a difference, performance-wise, if they are loaded from a stored query or an SQL string.

But let's see what the other experts have to add...
;-)

Jeff

 

by: deluk20Posted on 2009-11-04 at 08:20:05ID: 25740885

Most of the combo boxes contain a list of about 6 items on average. There a two which have about 100. One of the list uses a filter query, which has a couple of linked tables so I can later use the data in another function.

peter57r - so a 'stored query' is really just building the query via the properties box and the three dots? Isn't that just another way of building a query? I don't see really how much of a difference a 'stored query' against another and attaching it to the row source manually. Looks like that suggestion was really building me up to nothing.

Well if no more tips that are out of my control I'll award points soon.

Cheers guys


 

by: peter57rPosted on 2009-11-04 at 08:35:42ID: 25741068

A 'stored' query is what you see listed in the database window queries tab.  It has a name.

SQL strings in a recordsource or rowsource do not appear as queries in the database window.

Stored queries are faster than queries run from sql strings because they are processed in accordance with a compiled 'query plan' which is intended to optimise them.

Using the ... button was intended  to give you a built query from the outset; all you have to do is save it.  If you started from the database window, you have to do all the work yourself.  With 30 such queries I think that is worthwhile time saver apart from avoiding any errors as you rebuild them.

 

by: deluk20Posted on 2009-11-06 at 00:44:01ID: 31648894

Cheers guys for your input

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...