Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More Info on where to use DoEvents and what it does

Status
Not open for further replies.

jwoods7

Technical User
Feb 19, 2003
36
US
The help file in Access doesn't explain very well what DoEvents does for me. I'm still working on the problem of slow networking problems

One of the programs I have is designed to access info just like what my program does over a network. I don't understand why my program runs slower than the other one does when more than 1 person views data so I'm trying to "pick apart" the code of the program that does work. It almost seems like they copy all the data at the beginning (it takes longer to initially load), and then keep it in queue for easy access...
The only thing I see them doing though is when the program is loaded, it checks to see if the data is correctly attached. If not, it loads a form that requires users to enter the location of a valid data file. While this form is open, they are running DoEvents with a loop statement:

Call ChkAttach(True)
If isloaded("Attach Tables") Then
Do While isloaded("Attach Tables")
DoEvents
Loop
End If



One of the other strange things that I would appreciate if it could be explained better is the CLASS MODULES
Right after the loop above, they have:

BUS.Class_Initialize

They do this BEFORE running any functions in the program. Could this make each function run quicker? Why put functions in a Class Module instead of a Module...what is the difference?

Thanks in advance for the help, I'm sure I'll figure out how to get this program working faster sooner or later.
 
DoEvents

The DoEvents function just tells access to check all Events while waiting for your form ("Attach Tables") to be closed. If this wasn't there you would find that the form is not refreshed etc as access is stuck inside the loop. This should make no or very little difference to performance.

Are you splitting you database, into one file for the Backend and one for the FrontEnd, if you are you can try locating the FrontEnd File on PC's instead of on a server as this makes a difference on the performance.

You could also check your code to see if you have much SQL in code and if you do convert as much as you can to Access Queries, as Queiries when save create an execution plan which speeds things up, as SQL Queries in code as have to create this at execution time.

Classes

The Main difference between Modules and class modules in general are that class mdoules are written as application independent, so that they can be imported and used in any application easily, I usally use them for error trapping and things like that that are used in all my applications.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top