Progress Bar.. (1 Viewer)

Isaac

Lifelong Learner
Local time
Today, 14:55
Joined
Mar 14, 2017
Messages
8,777
Yes, unfortunately MsgBox is completely modal. It stops execution of all code until dispositioned. VBA is an unforgiving language, and single threaded, with no friend threads possible. :)

I might suggest you could create a form which exists for no purpose other than to display modelessly while other things are happening.

1. display form
2. run long process
3. close form
4. msgbox "done"

I do fully encourage what you are trying, I think giving the user appropriate visual cues that manage their expectations is HUGE in interface design. Even more important than best programming and best features. The worst feelings happen when users expect one thing, but get another--That seems to be even worse than, when they wish they had something that they didn't. Interesting psychology.
 

zelarra821

Registered User.
Local time
Today, 23:55
Joined
Jan 14, 2019
Messages
810
1. display form
2. run long process
3. close form
4. msgbox "done"
Do you have any examples made that you can take as a reference or do you know any? I have not done that in my life, and without seeing how it is done, I cannot implement it
 

Isaac

Lifelong Learner
Local time
Today, 14:55
Joined
Mar 14, 2017
Messages
8,777
Do you have any examples made that you can take as a reference or do you know any? I have not done that in my life, and without seeing how it is done, I cannot implement it
Hmm, let me make sure I understand, or maybe I should clarify. All I'm suggesting is:

create a form that says "please wait, processing" displayed somewhere on it
write your code to:
open the form (docmd.openform)
now run your process - whatever it is that you wanted to do that takes too long
close the form (docmd.close)
display a message box
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 17:55
Joined
May 21, 2018
Messages
8,528
I have already calculated the number of files that are in total in the folder. If 1000 files are 100%, one file would be 0.1%. That is, 10 files for each one percent. This is how I had it in mind.
The first time you span the directory you are not going to know the number of files (N). So whenever you change the default path, you do not know N. In those cases you can show an hourglass. The next time you span the folder looking for additions and deletions on the same folder you could show a progress bar based on the previous count. In this case if there was files added or deleted it will not make much difference. Assume you had 1000 files the first time. The next time you have 1010. You are not going to see much difference of n/1000 or n/1010
 

zelarra821

Registered User.
Local time
Today, 23:55
Joined
Jan 14, 2019
Messages
810
Thank you very much for your responses. In the end I have chosen to show an hourglass.
 

isladogs

MVP / VIP
Local time
Today, 22:55
Joined
Jan 14, 2017
Messages
18,220
Hi @zelarra821
Apologies, I had missed all the updates in this thread.
FWIW, I wouldn't have used a progress bar in your situation.
If its going to take some time I would just display a message as a label caption on the actual form. Something like 'Updating files. Please wait ...'
To ensure it is easily seen I use large font and bright colour e.g. magenta 20 pt.

When the process has completed, change the label caption to e.g. 'Update completed successfully'.
You could also make the text flash a few times to attract the user's attention.

You can see a variety of ways of getting user's attention in my example app Attention Seek - Mendip Data Systems
 

zelarra821

Registered User.
Local time
Today, 23:55
Joined
Jan 14, 2019
Messages
810
Hello, thank you very much for the example. I find some of the options very interesting.

You haven't missed much either. What others have proposed has been the same as you: uqe in my case it is better not to use the progress bar.

@Isaac proposed to me to open a form with the text "Loading ...", and to close it again once finished, which I have not been able to make it work. I think it was because I would have to add the action that will take time to develop in the OnLoad event of the form where it displays that informational message. I have to try it. If I succeed, yes I can use your method to blur the screen of the form below.

I keep your page because I think there must be very interesting things.

Thank you very much!
 

isladogs

MVP / VIP
Local time
Today, 22:55
Joined
Jan 14, 2017
Messages
18,220
Yes I skimmed the various posts to catch up...
You certainly could load another form to display a message to users and indeed blur the background ...
...but personally I would keep it simple - which is why I suggested just showing a message on the actual form in use

Here's an example chosen at random ...in this case with a message updated after each action ...and a progress bar (not relevant to your needs)

1612606837240.png


@Eugene-LS
I tried loading your example in both 32-bit & 64-bit Access but for info this error message appears when the form loads:

1612607113915.png
 

zelarra821

Registered User.
Local time
Today, 23:55
Joined
Jan 14, 2019
Messages
810
Ok, well I'm going to do it like this. Thank you
 

Users who are viewing this thread

Top Bottom