Solved

while waiting for form to load display progress bar

Posted on 2004-09-08
4
292 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 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

730 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