[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

while waiting for form to load display progress bar

Posted on 2004-09-08
4
Medium Priority
?
299 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

650 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