Timing of ADO vs. Form level events

Dugantrain

I Love Pants
Local time
Today, 08:52
Joined
Mar 28, 2002
Messages
221
Hi, all, I'm attempting to accomplish a task which I assumed would be really simple, but is giving me problems. I have a function which performs several ADO actions (Update, Insert, Delete). The function takes a while to fully execute, so I decided that I'd like to have a little label on my form which changes its caption whenever a new ADO call is made. Example:
Code:
Forms!My_Form.Form!My_Label.Caption="Performing 1st action..."
Connection.Execute ADO_Action_1
Forms!My_Form.Form!My_Label.Caption="Performing 2nd action..."
Connection.Execute ADO_Action_2
and so on. However, when executing the function, the ADO actions are all performed and THEN the labels do their thing. Is there a way to force the correct sequence or are VBA and ADO just not that in sync?
 
Code:
Forms!My_Form.Form!My_Label.Caption="Performing 1st action..."
[b]DoEvents[/b]
Connection.Execute ADO_Action_1
Forms!My_Form.Form!My_Label.Caption="Performing 2nd action..."
[b]DoEvents[/b]
Connection.Execute ADO_Action_2
 
You will find that action queries run from stored querydefs run significantly faster than code loops.
 
OK, the DoEvents works like a champ. Yes, Pat, I have now determined that queries do run faster than
ADO calls, but I like to sample things first before making a decision and I had never really used much ADO before this project. Another good example of this is one of my most recent projects; a performance tracking database which would've taken 100's of queries if I had developed it normally. I thought I'd be smart and wrote it with about 70 or so queries with subqueries in each. You can imagine the performance, it's like Frankenstein's monster, it was supposed to be a thing of beauty and elegance, not the horrid abomination I have before me now. It did, however, teach me 99.9% of everything I'll ever want or need to know about SQL.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom