Solved

while waiting for form to load display progress bar

Posted on 2004-09-08
4
286 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
Comment Utility
haved you tried to use doevents and timer control?
0
 
LVL 14

Expert Comment

by:aelatik
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
VBA Check for Character 9 69
VBA error replacing data 6 34
Using "ScreenUpdating" 6 45
vb6 connector to mongodb 2 25
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now