How to make a line in a sub run before another

garyholc

Registered User.
Local time
Today, 20:26
Joined
Jul 15, 2008
Messages
64
I would have thought the lines in a sub are executed in order, but I have a sub which updates the data in a list as such:

sub anexample()

me.statusbox = "Please wait..."

me.listbox1.rowsource = "Select blah blah blah"

me. statusbox = ""

End sub


Theroetically, I would have thought it would display the message in my text box called statusbox, then run the select statement (which takes about 10-15 seconds) and once it has done this, it will update the text box again.

But, instead, it seems to run everything at once, and it fetches the data before displaying the text in the textbox (have tried running without the last line to confirm this).

Is there any way to stop this?
 
You may be able to put a 'DoEvents' in after the rowsource line and make it work like you want...
 
Yes that worked, but prior to the rowsource line. Ken, once again, you are a star, thanks :)
 

Users who are viewing this thread

Back
Top Bottom