Link to home
Start Free TrialLog in
Avatar of Daron1
Daron1

asked on

Fixing a program that runs slow

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?
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

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.
Avatar of wsh2
wsh2

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


ASKER CERTIFIED SOLUTION
Avatar of GivenRandy
GivenRandy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Daron1

ASKER

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
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).
Avatar of Daron1

ASKER

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
Were you able to check the above URLs?
Avatar of Daron1

ASKER

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.
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
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.
Avatar of Daron1

ASKER

Comment accepted as answer
Avatar of Daron1

ASKER

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