Results 1 to 5 of 5
  1. #1
    Sarge is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2021
    Posts
    4

    Progress Display

    Hello everyone,



    I have inherited a massive amount of Access DBs in my new job and I am looking for help with some code or to see if this is even possible (google has failed me).

    What I want to do is add a progress box to a form opening to see exactly what query (of the many) it is working on. I have multitudes of forms that take forever to load I would like to see what queries are killing the load so that I can better understand how to fix them.

    Is this some thing anyone has ever done or seen?

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    9,653
    I once updated a label caption on a small form and increased a progress bar at each stage (divided the length by the number of queries and incremented accordingly). The caption displayed the phase being executed but I didn't have a timer on it. One thing that such a form needs is a pause routine (about 1 second) to repaint this form, otherwise the next query takes over and windows (forms) in the app don't have time to repaint. Before each query was executed in code, the form label and bar was updated. If all you really need is length of time to execute each query, you could get the system time before and after each and write that to a log file (simple text file).

    Something here wrt speed of execution might help http://www.mendipdatasystems.co.uk/s...sts/4594424200
    Colin is a regular contributor here.
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    Iím telling everyone it's good to eat dried grapes. Itís all about raisin awareness.

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    1,316
    used to use the statusbar to advise users where we were in the stage of things
    Importing Excel file .....
    Verifying File ....
    Importing verfied to database ....
    Calculating new values....

    That sort of thing?

    Code:
    SetStatusBar ("Adding Payroll records ....")
    
    
    
    Public Function SetStatusBar(strStatus As String)
    Dim VarReturn As Variant
    
    
    VarReturn = SysCmd(acSysCmdSetStatus, strStatus)
    
    
    End Function
    HTH
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?search_query=debug+access+vba



  4. #4
    Ajax is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    9,297
    My technique is to put something like


    debug.print "formname", "eventname", now()

    in each of the form and any subforms open, load and current events (whether they have any code or not). Data gets loaded in the load event and subforms get opened before the main form - and the current event can be called many times - for example a main form with 2 subforms will execute the open, load and current events for the first subform and repeat the current event twice more, once when the second subform opens and again when the main form opens. Not sure but I think listboxes and combos are populated in the open event

    If you want to create a general function you can use something this

    Code:
    Function WhatWhen(fName as string, eName as string)
    static pTime as date
    dim t as date
    
        t=now()
        if isnull(pTime) then 'this is the first call so set the prior time 
       
           ptime=t
           debug.print "Initial event starting with ", fName, eName
    
        else
    
           debug.print fName, eName, t, t-pTime
           ptime=t
    
        end if
    
    End Function
    call this event once at the beginning of any code in the event you believe is the first to execute and again at the end then just at the end for all other events

  5. #5
    isladogs's Avatar
    isladogs is offline Very idle programmer
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,068
    As well as my various speed comparison tests mentioned in post #2 (for example: Optimise Queries), I also have a progress bar example app which you could adapt for the purpose. See Progress Bar - Mendip Data Systems

    I use this the accompanying text to indicate the current action being performed e.g. when running several queries in succession using code or when relinking tables:

    Click image for larger version. 

Name:	Capture.PNG 
Views:	14 
Size:	73.2 KB 
ID:	46240
    Colin (Mendip Data Systems): Website, email
    Try again. Fail again. Fail better.
    A
    sking for help isn't giving up. Its refusing to give up.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 14
    Last Post: 07-30-2017, 05:25 PM
  2. Progress bar on start up
    By craig1988 in forum Programming
    Replies: 4
    Last Post: 02-22-2016, 11:11 AM
  3. Progress Bar
    By pkstormy in forum Code Repository
    Replies: 3
    Last Post: 09-21-2012, 10:27 AM
  4. Progress bar issue
    By TheShabz in forum Programming
    Replies: 11
    Last Post: 11-15-2011, 08:29 PM
  5. How to use progress bar
    By marianne in forum Access
    Replies: 19
    Last Post: 04-01-2009, 09:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums