Show a Progress Bar on Form Loading ...

My idea didn't work, but I noticed something very odd (at least to me) also ...

First what I tried:
  • I had my database open and saved a copy of it, so if this didn't work I could go back to what I had so far.
  • I copied frmPB5 and the two modules from @isladogs example file.
  • I opened frmPB5 in my database, and it was working, but it was basically maximized.
  • I changed frmPB5 to PopUp - Yes in design view.
  • I commented out my progress bars and opened frmPB5 in FormLoad (of frmFormA) and closed it in FormCurrent (of frmFormA).
  • It works about like the progress bars that I had - i.e. I saw frmPB5 pop-up, it said step 2 of 600 and then it stayed of Step 2 of 600, the status bar PB kept going and then the frmFormA opened normally.
If it had worked, I would have had to make a lot of changes to the form to make it look similar to my other PB's, but ...

Now the odd thing:

When I first open the database from home, frmFormA takes about 45 seconds to load, in the office it takes 1-2 seconds. If I close frmFormA (via the X on the tab using tabbed view) and then re-open it from home, it takes 1-2 seconds to load - like it does in the office. Does this seem strange to anyone?
 
Marked the thread as solved as @Josef P.'s suggestions work well enough for my purposes. I changed my Progress bars so they initially come up at 50% and then go to 67%, 84% and 100% as the three subforms load. It gives the desired effect although they don't move smoothly.
 
Progress bars are old hat these days.
You need to use that circle of dots, that shows no indication whatsoever as to when something is going to complete. :)
 
I wasn't suggesting you imported my form but instead that you used that approach.

In fact, my progress bar is very easy to use
a) Define the number of 'steps' - default is 50 if not otherwise set
b) SetupProgressBar frm - displays the progress bar controls in the active form
c) UpdateProgressBar frm - updates (moves) the progress bar after each step
d) HideProgressBar frm - hides the progress bar controls

Normally it responds to a series of events but will work on a timer
You can interrupt the process at any time with suitable code at step c) which hides the progress bar and exits the procedure

In the case where you want to use it whilst 2 subforms load, build these in as two steps

However, an even simpler method may be to use a label caption e.g. "Loading the subforms. Please wait . . ."
Then keep adding another "." at the end of the caption on a timer event e.g. every second whilst the subforms load
 
I wasn't suggesting you imported my form but instead that you used that approach.
Understood, but when I imported your form it did not update.

And before I updated it, it didn't look like your code would really do what I wanted (no offense).

i.e. when I modified your database to open frmPB5 at startup, the PB ran for a full minute, it did not stop when the form was current (granted it would have zipped by in less than a second.)

If I can have a Progress bar that opens at form load and advances and ends at form current - that is what I am looking for, but your database didn't seem to do it and @The_Doc_Man and others are saying it can't be done.
 
That appears to be an hourglass?
1692216233519.png

Busy cursor - they just still call it an hourglass. In Win10 we typically call it "The spinning circle of death" (especially if you forget to set it back to 1 in your code).

Very similar to your circle of dots, if they were spinning fast enough.
 
View attachment 109473
Busy cursor - they just still call it an hourglass. In Win10 we typically call it "The spinning circle of death" (especially if you forget to set it back to 1 in your code).

Very similar to your circle of dots, if they were spinning fast enough.
I will have to give that a try. :)
 
It comes in handy for a lot of things in VBA that may take 20-30 seconds to load, but DON'T trigger the busy cursor.

You don't really want to code a PB or pop up a "Please Wait" message for that. But you don't want users clicking buttons b/c they think something should be happening, but it isn't.

As I said, just remember to turn it off especially before a MsgBox or InptBox or you'll have users saying "I need to input something here, but the systems been busy for 30 minutes ..." <OOPS!!!>
 
Oh, it will not be for anything serious, just as an experiment.
I only use access for personal use now.
 
Forgot to mention, it only works in Access and you can also use DoCmd.Hourglass = true/false - but that seems to reset when the current procedure ends: https://learn.microsoft.com/en-us/office/vba/api/access.docmd.hourglass

In Excel - it is Application.Cursor: https://learn.microsoft.com/en-us/office/vba/api/excel.application.cursor
In Word - it is System.Cursor: https://learn.microsoft.com/en-us/office/vba/api/word.system.cursor
In Outlook - it looks like it can be applied to a control on a form, without the control being clicked: http://www.vbaexpress.com/forum/showthread.php?16761-Solved-Is-there-an-Hourglass-in-Outlook
I couldn't find an equivalent for PowerPoint, although people asked.

Nice of Microsoft to be consistent across applications ...
 
Hi MB, is it possible to change how you are connecting to the office? I have recently moved my Access DB to a remote server which I now connect to via Remote Desktop and the performance is only slightly slower than when the database was in my office. The Front End and Back End are both on the remote server and even my most complicated form which has 6 subforms and also tabbed sub-subforms opens in less than 2 seconds.
Just a thought.
 
Hi MB, is it possible to change how you are connecting to the office?
Yes, but 6 to one and half a dozen to the other ...
  • When COVID19 first hit, I had a desktop in the office and they gave me a loaner laptop and let me remote into the desktop using it. That worked okay speed wise, but there were issues - mainly if IT re-booted or someone happened to turn off the desktop. I have a laptop now and they won't issue me a laptop and a desktop.
  • In theory I could leave the laptop in the office and remote in from another PC (mine), but I don't have a spare PC to use, and that creates the same issues as before.
  • I do have access to Citrix and can run the database off Citrix and it opens very quickly there. But 1-2 minutes for the database to load locally vs. 1-2 minutes for the Citrix OS to load and then 15 seconds for the database to load, plus I have apps locally that aren't on Citrix, so swapping back and forth.
 
@NeilT123 - your idea is valid. By keeping everything between the FE and BE as a local operation, you surely reduce the network load. However, be aware that RDP solutions DO require careful configuration of the user's login and connection context to keep the FE as a distinct entity that is not directly shared. Some RDP admins don't do that step properly.
 
Load subform later: start with empty subform and after the main form is loaded, reload the subforms (controlled by Form.Timer).
This takes longer (measured), but looks faster. ;)
I ran into a slight glitch with this - actually a co-worker discovered it.

One of my subforms is a table imported from an Excel spreadsheet.

The width of the subform was 3.7201 - which is just wide enough to not require scrollbars and just narrow enough to show all the fields with no extra white space.

After the import, the scroll bars were present and I tried re-sizing the subform and 3.885 has the scroll bars and 3.89 has about a 1/4-inch gap on the right where it looks like the scroll bars should be.

I think the form had special effect sunken - but I think all of that should have carried over.

All of the main forms that include this type of subform are affected.

The other two subforms transferred over with no issues.

Any idea what I did wrong or how to correct it?
 
I wasn't able to figure out why the Subform was not sizing properly - oddly, it did size properly on 3 of the 5 forms that used it.

I ended up loading it before the main form loads, but still loading the two other subforms after the main form loads.

Working fine again!
 
Actually, I found another glitch, but I only notice it at home with the slower network connection ...

@Josef P. said in Reply #10 to turn the timer on in the FormCurrent Event, then in the timer event to turn the timer off and load the subforms.

What is happening is every time the form is current, the timer event fires again - so every time I go to a new record, I see a progress bar and my subforms load (actually, the second subform loads too quickly to be visible, but it is being reloaded).

I need the timer to run only on the initial load.

I tried the following, but it didn't seem to change anything:
Code:
Private Sub Form_Current()
    Dim FirstLoad As Integer
    If FirstLoad = 0 Then
        FirstLoad = 1
        Me.TimerInterval = 1
        Unload ufProgress ' Kill progress bar
    Else
        Me.TimerInterval = 0 ' Timer Off
    End If
End Sub

If necessary, I can go back to loading my subforms with the main form and I'll still have the initial progress bar, but I liked the late subform loading idea, if it can be made to work.
 

Users who are viewing this thread

Back
Top Bottom