Results 1 to 6 of 6
  1. #1
    AJM2013 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    5

    Please Wait Form - Form_Timer Animation Not Working

    I have a SearchResults form that is used to input a search criteria. When the user is ready to display the results found they press the find button. All the results found based on the search criteria will be displayed in a listbox (searchResultsFound) on the SearchResults form.

    Since the search can generally take 10 seconds to 1 minute to display results in the list box. I created a PleaseWait form that will appear once the find button has been clicked and will be displayed until the results are shown in the list box. The PleaseWait form has a simple animation of squares that change colours. If I open the form on its own, the animation works. Form and Code shown below.

    Note: The results displayed are coming from a table with more than 1 million records



    Code for the PleaseWait form below:
    Public Sub Form_Timer()

    Dim beforecolour As Long
    Dim afterColour As Long

    beforecolour = RGB(140, 140, 140)
    afterColour = RGB(255, 9, 9)
    ClockName = ClockName + 1

    If ClockName > 6 Then

    ClockName = 1
    Me.b1.BackColor = colour
    Me.b2.BackColor = beforecolour
    Me.b3.BackColor = beforecolour
    Me.B4.BackColor = beforecolour
    Me.b5.BackColor = beforecolour
    Me.b6.BackColor = beforecolour

    End If

    Select Case ClockName
    Case 1
    Me.b1.BackColor = afterColour

    Case 2
    Me.b2.BackColor = afterColour



    Case 3
    Me.b3.BackColor = afterColour

    Case 4
    Me.B4.BackColor = afterColour
    Case 5
    Me.b5.BackColor = afterColour
    Case 6
    Me.b6.BackColor = afterColour
    End Select

    End Sub

    When the user clicks on the find button, the PleaseWait form appears and does everything it is meant to do, except for the simple animation. Shown Below.



    The code behind the find button shown below.


    DoCmd.OpenForm "PleaseWait"
    DoCmd.RepaintObject , PleaseWait
    Forms![searchResults]![searchResultsFound].RowSource = "SearchResults-BasedOnSearchCriteria"
    Forms![searchResults]!recordCount.Value = DCount("*", "SearchResults-BasedOnSearchCriteria")
    DoCmd.Close

    SearchResults-BasedOnSearchCriteria = A Query

    After trying all sorts of things, the following lines in the code is the problem. If I take these out the animation on the PleaseWait box works

    Forms![searchResults]![searchResultsFound].RowSource = "SearchResults-BasedOnSearchCriteria"
    Forms![searchResults]!recordCount.Value = DCount("*", "SearchResults-BasedOnSearchCriteria")

    Does anyone have any ideas, or is there a way to force the PleaseWait form to Open and begin animation before setting the row source for the list box?

    Any help would be greatly appreciated

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Access is *not* multi-threaded so your Timer event is not doing anything while the DCount() is running.

  3. #3
    AJM2013 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    5
    Thanks, I didn't know that access was not multi threaded.

    instead of using Dcount, I have change it to the following.

    Forms![searchResults]!recordCount.Value = Forms![searchResults]![searchResultsFound].ListCount

    Animation still not working, so I have taken the animation out, and everything works as it should

    This may be a silly question So there is no possible way to have a please wait message box with some sort of animation, if there is any code that is running sum sort of action (e.g setting a value(s)) Just thought I would ask before I select SOLVED.

    Thanks

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You are correct. Animation while waiting is not one of Access's strong points. Sorry.

  5. #5
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614

  6. #6
    AJM2013 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    5
    Thanks for your suggestion, the user is aware that something is happening.
    The issue I had, it would run the query first, once the query was complete, it would then run the VB code to populate the listbox. It is great idea though. So I am thinking I will leave the please wait form with some text, and leave it at that.

    Thanks for everyone's help, i really appreciate it.

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

Similar Threads

  1. Pause / Wait / Countdown / Timer
    By DevGreg in forum Programming
    Replies: 2
    Last Post: 07-19-2022, 06:30 AM
  2. Replies: 6
    Last Post: 01-16-2013, 12:12 PM
  3. wait and shell
    By maxbre in forum Programming
    Replies: 19
    Last Post: 11-03-2011, 11:10 AM
  4. Wait for query to finish
    By MikeDS in forum Programming
    Replies: 1
    Last Post: 01-28-2011, 10:17 AM
  5. Open Form with instance method & wait to close?
    By GeorgeBakoyannis in forum Forms
    Replies: 1
    Last Post: 10-09-2010, 11:00 AM

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