Results 1 to 9 of 9
  1. #1
    khhess is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    11

    Create progress bar

    I'm stuck!
    I'm running a VBA code to compare a local table with a ODBC table on my home computer.
    Data no existing in my loacl will be added, so I compare both tables. Works great.
    But now, because the connection goes through the internet and is sometimes a liitle slow I tried to design a
    progress bar, by changing color after each section.
    All txt boxes are chancing color only, after ALL query's are finished.
    I tried to add an requery for the Text17 in this example, but again color change only after ALL 20 queries are complete.

    I'm new in VBA and need a little bit help.

    Thanks

    .......
    DoCmd.OpenQuery "Init_del_Customer", acViewNormal, acEdit (empty temp table)
    DoCmd.OpenQuery "qry_Customer_down_select", acViewNormal, acEdit (compare both table with isNull and write ID into temp table)


    DoCmd.OpenQuery "qry_Customer_download", acViewNormal, acEdit (adding new recordes from table A to table B by using ID in table temp)

    Text17.BackColor = vbGreen (set color to green after section is complete, this is what is not working)

    DoCmd.OpenQuery "Init_del_Customer", acViewNormal, acEdit
    DoCmd.OpenQuery "qry_Customer_upload_select", acViewNormal, acEdit
    DoCmd.OpenQuery "qry_Customer_upload", acViewNormal, acEdit
    Text18.BackColor = vbGreen
    .....
    .....

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Access may be single threaded but it is multi-tasked. Try issuing a DoEvents frequently to give the processor to other tasks.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Google (or Bing): Access progress bar

    http://www.bing.com/search?q=Access+...&sp=-1&qs=n&sk=
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    khhess is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    11
    Thanks for the DoEvents and the progress bar.
    I tried DoEvents, but the code stops after the first DoEvents without Error.

    DoCmd.OpenQuery "Init_del_Customer", acViewNormal, acEdit
    DoCmd.OpenQuery "qry_Customer_down_select", acViewNormal, acEdit
    DoCmd.OpenQuery "qry_Customer_download", acViewNormal, acEdit
    box1.BackColor = vbGreen
    DoEvents
    DoCmd.OpenQuery "Init_del_Customer", acViewNormal, acEdit
    DoCmd.OpenQuery "qry_Customer_upload_select", acViewNormal, acEdit
    DoCmd.OpenQuery "qry_Customer_upload", acViewNormal, acEdit
    box2.BackColor = vbGreen
    DoEvents

    I google but I found no solution.
    The progress bar, I dont know how to put the code into, because sometimes these queries are done in 10sec, sometimes in 30sec.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The code should *not* stop after a DoEvents but return from the tasker and pick up where it left off. How are you determining the code stops running?

  6. #6
    khhess is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    11
    Because box 2 is not changing color and I can see no more network activities. The queries are connecting through a odbc database.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    So at least box1 is now changing color? How about puting a MsgBox right after the DoEvents to see if it will display?

  8. #8
    khhess is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    11
    Good idea,
    Box1 is changing is color but not box2.


    FOUND IT!
    It was a misspelling plus my error handling was wrong, thats why I didnt saw an error message.

    Thanks

    Guys
    Last edited by khhess; 09-29-2012 at 06:21 PM.

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Excellent! Thanks for posting your success and solution. I marked this thread as Solved for you.

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

Similar Threads

  1. Progress Bar
    By pkstormy in forum Code Repository
    Replies: 3
    Last Post: 09-21-2012, 10:27 AM
  2. Progress bar issue
    By TheShabz in forum Programming
    Replies: 11
    Last Post: 11-15-2011, 08:29 PM
  3. Form Progress/Status Bar
    By Tomfernandez1 in forum Forms
    Replies: 2
    Last Post: 06-09-2011, 01:01 PM
  4. Progress/Status Bar on Form
    By Tomfernandez1 in forum Forms
    Replies: 5
    Last Post: 05-10-2011, 04:41 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