Solved

while waiting for form to load display progress bar

Posted on 2004-09-08
4
291 Views
Last Modified: 2008-02-01
i have a for next loop reading about 29 records this takes a bit when i have the form load


events are as fallows

1: form loads alowing user to pick from pulldown
1a: on this same form we have a menu with report/show report
1b: if the user clicks the show report this loads onther form(heres where my problem lies)

2: report form loads with loop 0 to 28
2a: i assume i have to place the progress bar advancement here as this is where the form takes time to load/display
2b: side note: it does nto display this from till the data retirved is complete

3: report form popsup with data and time has pased looking like nothing happened

so id like to have a proress or wait while loading something to say hey im getting this data its gonna take a bit please wait


thanks
Pern
ps: i know theres alot of answers for this but non seamed to fit or worked forme
plus i dint get where to put code please explin where things go too thx alot
0
Comment
Question by:Johnny
  • 2
4 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12008481
haved you tried to use doevents and timer control?
0
 
LVL 14

Expert Comment

by:aelatik
ID: 12008511
1. First of all, put everything from FORM_LOAD event in an own defined function.
   
    Something like :
    Function FORM_START()
       ' Your code with loops etc.
    End Function

2. Place a timer control and set its interval to 1000, so that it will trigger after 1 second.
3. Put the following code in the timer control.
   
   Private Sub Timer1_Timer()
    Timer1.Enabled = False ' disable the timer after first time because we don't need it anymore
    Call FORM_START
   End Sub

4. Implement the progressbar in the loops, like following :

    progressbar1.min = 0
    progressbar1.max = 28
    For i = 0 to 28
      progressbar1.value = i
      Doevents
    next i
0
 
LVL 32

Expert Comment

by:Erick37
ID: 12008843
You may try something simple like this on the form which is loading...

Private Sub Form_Load()
   
    Dim i As Long
    Me.Caption = "Loading, please wait"
    Me.Show
    DoEvents
    For i = 1 To 2000
        'some loading process
        Debug.Print "loop " & CStr(i)
    Next
    Me.Caption = "Form1"
   
End Sub
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 500 total points
ID: 12009314
A little modification which displays a progressbar while the form loads, then hides it...

Private Sub Form_Load()
   
    Dim i As Long
    Me.Caption = "Loading, please wait"
    Me.Show
    DoEvents
    With ProgressBar1
    .Visible = True
    .Max = 28 'Set the max value to match the loop number below
    For i = 1 To 28
        'some process
        Debug.Print "Progress " & CStr(i)
        'Call Sleep(300)
        'Update the progress bar
        .Value = i
        .Refresh
    Next
    .Visible = False
    End With
    Me.Caption = "Form1"
   
End Sub
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MS Access - Capture pressed key onclick 4 41
VBA filters 2 64
Access query that references subform 5 47
Set WorkSheet  not Working 9 38
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question