Solved

Fixing a program that runs slow

Posted on 2000-05-14
12
139 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
12 Comments
 
LVL 142

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
 

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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now