Solved

Fixing a program that runs slow

Posted on 2000-05-14
12
143 Views
Last Modified: 2010-05-02
I have a program that has a small access DB that slows down the program quite a bit.  The DB is setup with DAO.  To give an idea of the delay, when the program is first run, the time for it to load is about 8 seconds.  Is this a normal speed for including a DB or is there something I can add or modify to increase the speed?
0
Comment
Question by:Daron1
[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
12 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2808237
To have an initial connection to Access, 10 seconds is absolutely normal (if you have some splash screen, this will calm the user :-)

The most important is performance during normal operations, if here during switch of forms still same delay is given, then you have some code review to do.
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2808247
What is in your SQL SELECT statement?
If you can, simplify it to include only those fields you need. Eg.

SELECT [MyField1], [MyField2] FROM MyTable

rather than:

SELECT * FROM MyTable

What are the controls you are loading, and how are you loading them? Say you are using a recordset with data that is out of sequence and the Sorted property is set to True. With each Listbox.AddItem you do, a complete Listbox sort is going to take place, before you add the next Item. Set Listbox Sorted to False before doing your adds, and then reset it to True as soon as all the records are loaded. Or better yet, use the ORDERBY clause in your SQL statement to have the records in proper order. Eg.

SELECT [MyField1], [MyField2] FROM MyTable
ORDERBY [MyField1] ASC


0
 
LVL 9

Accepted Solution

by:
GivenRandy earned 35 total points
ID: 2808258
Yes, 10 to 15 seconds is normal.  What you might want to do is open the connection when you load the form and close it when you unload the form.  That way, if a user clicks a button (or something similar), he doesn't have to wait 10 to 15 seconds.

If you have a small section of code that needs optimizing, I can run it through my TrueTime -- a great tool that all VB developers should have if performance is a major concern (most programs are not overly concerned with performance, though).
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Daron1
ID: 2808844
GivenRandy:
Is there a place I can get TrueTime for a trial?  I've never used one, but I would like to see if this may be my problem.  The program is also hanging for a while when I try to exit the program.  I haven't made an .exe yet as it is still being developed.  If you think the DB may be a source of it I can provide you with the form it's used on to check if I am doing something I shouldn't be doing :).
Daron
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2808948
The TrueTime for VB is at:

http://www.numega.com/devcenter/tt.shtml

You can get a preview at:

http://www.numega.com/previews/previews.shtml

However, it is fairly expensive for individual use.  We bought the whole suite because it was more than worth it (performance was crucial).
0
 

Author Comment

by:Daron1
ID: 2809105
GivenRandy:
Is there a place I can get TrueTime for a trial?  I've never used one, but I would like to see if this may be my problem.  The program is also hanging for a while when I try to exit the program.  I haven't made an .exe yet as it is still being developed.  If you think the DB may be a source of it I can provide you with the form it's used on to check if I am doing something I shouldn't be doing :).
Daron
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2809146
Were you able to check the above URLs?
0
 

Author Comment

by:Daron1
ID: 2810335
I don't know why it put my comments twice.  I looked at the pages, and it looks like it would be a great thing to have, however it is more than I would like to spend for the projects I work on.  This is the first time performance has been a problem for me.  If you are able to check code on a single MDI child, I'll send it to you.
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2810809
Of course, it depends on the code, but I should be able to do it.  Can you give me an idea what you would like to happen.  For example, is it just the startup time?  Is it when a user does some particular action?

You can email to: GivenRandy@aol.com
0
 

Expert Comment

by:daron
ID: 2812777
The process seems to be slow on startup and ending.  Once the information is loaded (such as DB info), it doesn't seem to have any problem.  I think the only control I've added since it has been slow is the Access DB, which is actually called from two different forms.  One inprovement may be to move the DB to a module where it is instantiated only once for both forms.  But this is only part, as it was slow before I added the second form.
So in a nutshell, the slowest parts is on startup and on ending the program.  The code for the form is pretty small, only a few functions.  So it may be clear to you as to what may need to be improved.
0
 

Author Comment

by:Daron1
ID: 2849514
Comment accepted as answer
0
 

Author Comment

by:Daron1
ID: 2849515
I checked the task list when the program started to run slow, but didn't find any other instances of the database or VB program.  I believe it is a battle of resources for a variety of unreleated issues.  I am sure that the problem is not associated with the access DB.  It was indeed a great learning device though.  Thanks.  Daron
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

Title # Comments Views Activity
VBA: Select SQL query based on a config Sheet v2 11 52
Macro Excel - Multiple If conditions 2 88
Problem to With line 4 76
transition to visual .net from vb6 5 64
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

697 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