How to create a Thinking Bar not a Progress Bar

V

Victor Torres

I know that there are a lot of progress bars that look very nice but what I
need is a thinking bar that will be display while some process occur. Is
similar to what the hourglass is but instead a bar. Very similar to the
windows thinking bar. I design one but in the codes I can't get it to work
in the background while the others process occur. Is there some way to
create this?? I know there is. Please help.. Thanks.
 
D

Dirk Goldgar

Victor Torres said:
I know that there are a lot of progress bars that look very nice but what I
need is a thinking bar that will be display while some process occur. Is
similar to what the hourglass is but instead a bar. Very similar to the
windows thinking bar. I design one but in the codes I can't get it to
work
in the background while the others process occur. Is there some way to
create this?? I know there is. Please help.. Thanks.


What did you try? My first approach to this would be to use a form with a
text box or label, updating the value or caption of the control in the
form's Timer event to create the effect of cyclical movement. You'd
probably have to use the DoEvents statement inside your processing loop to
allow Access to process the Timer event of the "thinking bar" form.
 
M

Marshall Barton

Victor said:
I know that there are a lot of progress bars that look very nice but what I
need is a thinking bar that will be display while some process occur. Is
similar to what the hourglass is but instead a bar. Very similar to the
windows thinking bar. I design one but in the codes I can't get it to work
in the background while the others process occur. Is there some way to
create this??


Similar to a progress bar, call the bar managing procedure
from strategic points in the "thinking" procedure.

Sometimes, you can just use the form's Timer event to adjust
the bar.
 
J

Jaek

Victor -

It sounds like you're working on something similar to what I ran into a few
weeks ago. I didn't want a genuine 'progress bar' that updated according to
the completion of some task, I just wanted a repeating graphic to show users
that the application hadn't locked up (and to keep their cool for a few
seconds). There are a lot of ways to do this and I tried a fair slice of
them, but after repeated failures and lots of digging through the discussion
boards I finally found some posts that indicated that there are many cases in
Access where a 'thinking' bar like this isn't possible (at least for a simple
guy like me).

For example, I wanted to have a little graphical doodad to keep users
occupied while I loaded a form bound to a big slow query on a large number of
records. Unfortunately once Access started processing that query, VBA seemed
to be 'locked out' until the query was done and the form loaded. Not even
code in the timer event would run. In the best case scenario the progress bar
form would pop up, freeze while the query ran, and then wrap up in a few
nanoseconds once the query completed.

I even tried a trick where I used an animated GIF, but (I guess because it
was being loaded from within Access and didn't have its own thread or
whatever) again the graphics weren't updated while the query ran, and it just
froze.

From what I read, this phenomenon has something to do with the fact that
Access isn't threaded (or a simple VBA programmer like me isn't capable of
invoking a thread) such that an Access application can be running a heavy
query but also surrender resources to your VBA code long enough to allow a
graphic update to a form.

Now, if I was just hellbent on seeing a progress bar up there, I suppose I
could use an unbound form (which I ought to do anyway), and then create the
underlying recordset in VBA, using a loop to iterate through each record as
I'm writing it so I can stick in an update to the progress bar form. But it
seems perverse to further slow down the loading of the query by adding the
overhead of running a one-record-at-a-time loop through a huge recordset for
the sake of a progress bar. "The program is even slower, but you have a nice
graphic to do a dance for you while you wait the extra 10 seconds."

Anyway, I post this in part hoping someone will show me that I'm
wrong/crazy, but also because if I'm right, there are a lot of ways to do the
whole progress bar type thing and a lot of info on that that will get thrown
at you, but it took me a pretty long time to find the post that said 'sorry
kid, you can't always do this'.

(Pardon me for any mangling of actual programming vocabulary terms above...)
 
V

Victor Torres

Hi... I also look in almost all the forums that handle access and found that
nobody have try or succeed in creating this. The form that I create was
using the timer and with a nice work with the graphics it looks like a very
nice thinking bar. I try to start the form as dialog in the beginning of the
macro that handle all the queries but again it start but until I don't close
the form the macro doesn't continue. I know that there is a way. This
happens very similar to the sample program that I did to calculate how old
are you and how many month, days and hours are left to your next birthday.
Everybody told me that was impossible in access and I did it. I just need
somewhere to start looking. Anyway how did you manage to do it or did you
just give up????
 
A

Albert D. Kallal

Take a look at my super easy word merge......


Try a sample merge to a word document...you see the progress bar move
forward.


Also, try the sample form in which I drive the progress bar by a form
timer.....

Just remember that "while" the query is running, you not be able to update
the progress bar, but, if you have 5 queries...then you update the progress
bar 5 times......(and hopefully each query takes about the same amount of
time).

The sample I have can be found here:
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
 
D

Dirk Goldgar

Victor Torres said:
I try to start the form as dialog in the beginning of the
macro that handle all the queries but again it start but until I don't
close
the form the macro doesn't continue.

If you open the form in dialog mode, nothing will continue until the form is
closed or hidden. So you don't want to do that, you probably want to set
its PopUp property to Yes, but open it normally. As I mentioned in my
reply, you can allow the form to update itself while your code is running by
executing a DoEvents statement every so often. However, I don't know
whether the form's Timer event will fire while a query is executing or
not -- I haven't tested that.

It occurs to me that there is probably a Windows API call you can make for
this purpose, and that is quite likely a simpler way to do it.
 
V

Victor Torres

Thanks for your help. In the past I look at your web page and have use some
of the codes that where great. But I think that this time is not what I am
looking for. I create a nice thinking bar that use the timer to move a very
nice pic from one side to the other and back again just as your progress bar
start all over again. But what I can't see how to manage is to run the timed
thinking bar while all the queries are running with no incremental number
adding with each queries. Thanks
 
D

Dirk Goldgar

Dirk Goldgar said:
However, I don't know whether the form's Timer event will fire while a
query is executing or not -- I haven't tested that.

Now I have, and it doesn't look like this method will work if long-running
queries are involved. The form doesn't seem to be updated while the queries
are running.
 
V

Victor Torres

Hi Dirk, I manage to make something that maybe will work.. still I'm
looking for something at the level as the Allen or Steven type of work.
Anyway I will keep looking for this... I don't know if you want to see what
I have so you can look if there is something else I can look at. Thanks in
advance
 
D

Dirk Goldgar

Victor Torres said:
Hi Dirk, I manage to make something that maybe will work.. still I'm
looking for something at the level as the Allen or Steven type of work.
Anyway I will keep looking for this... I don't know if you want to see
what
I have so you can look if there is something else I can look at. Thanks
in
advance


Sure, post it here if you can. But I set up what I think is the closest
possible all-Access approach, and it's not adequate. I'm looking at
adapting this Windows API code from VBNet:

http://vbnet.mvps.org/code/comctl/progressbar.htm

.... to Access, using the marquee style for the progress bar, but it's not
completely trivial and I don't have much time to devote to it right now.
 
J

Jaek

Victor, I gotta be straight, I gave up on the thing. As several other folks
have indicated here, within Access/VBA, everything seems to be pretty much
hung during long-running queries -- timer events, everything.

I can see where Dirk is heading with the idea of 'getting outside' this by
going out to the Windows API - that'd be cool if it works, but as the man
says, it's not your everyday VBA kinda thing. I will totally donate $1 to the
charity of Dirk's choice if he makes it work! :) Same offer to you if you
conquer this - good luck!
 
D

dymondjack

Nicely put Jaek...


I'm no expert when it comes to making progress bars, but I have to agree
with Jaek here. They are in general a pain in the you know what in the best
of times.

You'll notice that even in high-dollar applications you rarely ever see a
progress bar that is a smooth and steady transition from start to finish. I
think this is largly due to the fact that windows will not yeild processes to
increment your bar. This is continuously a problem for programmers.

I just installed a copy of Autocad 2010, and about quarter-way through the
installation the progress bar hung up long enough for me to think that
something may have gone wrong. I actually got up and walked away for about
ten minutes, and when I returned it was seemed to be just moving again.

Point being, a smooth and steady progress meter of any sort that will work
for all the functions of an application has still yet to have been achived
for anything other than the simplest of programs. I think windows vista may
have some improvements in that area, it seems to be a bit less noticable, but
still hardly perfect.

Funny that something seemingly so simple can be such a major task.

good luck!

--
Jack Leach
www.tristatemachine.com

- "Success is the ability to go from one failure to another with no loss of
enthusiasm." - Sir Winston Churchill
 
V

Victor Torres

ok... here is the thinking bar that I create. The codes are very bad but the
end product look nice so if you found that you could fix the codes you are
welcome to let me know how to make it better.

http://www.vtronixcorp.com/download/Thinkingbar.zip

now, you told me to use the DoEvents. How can I implement this? is my
first time that I heard that term and look but didn't find a lot of info of
how to use it. By the way, I'm looking into create a small web site so
anybody can upload sample of codes and also download others samples. Thanks
for any help that you can give me.
 
V

Victor Torres

Thanks Jaek. As I told Dirk, I will create a small web site as same as all
other site like allens site and steven. But what I will do is create one
that all the people that has any knowledge in access can upload sample of
code so other can benefit from it. Anyway I post an example of the thinking
bar that I design. As I told Dirk the codes are very bad because I'm not
that good at vb. Anyway let me know what do you think. Thanks...
 
V

Victor Torres

Hi to all, I DID IT!!!!!!!!!!!!!!!!!!!
YES!!!!!!!!!!!!!!!!!!!!!!!

Using the Gif98.dll with an animated gif of a rolodex or actually any gif I
put it in a form and open it befor the process of the queries and bingo!!
the animated gif will appear while the queries runs.

if any one want's to know how let me know and I post it step by step.
Thanks to anyone that help me in this matter.

YESSSSSSSSSSSSSSSSSSS!!!!!!!!!!!!!!!
 
T

Tony Toews [MVP]

Victor Torres said:
Hi to all, I DID IT!!!!!!!!!!!!!!!!!!!
YES!!!!!!!!!!!!!!!!!!!!!!!

Using the Gif98.dll with an animated gif of a rolodex or actually any gif I
put it in a form and open it befor the process of the queries and bingo!!
the animated gif will appear while the queries runs.

if any one want's to know how let me know and I post it step by step.
Thanks to anyone that help me in this matter.

Sounds interesting. Please post the URL for where you downloaded it
and sample code.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top