Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2004
    Posts
    18

    Unanswered: Flashing textbox, again!

    I've read all the threads about this subject but still can't seem to make it work for me.

    My form accepts input from user to run a query and reports. To inform the user of the progress of the processing, there's a textbox which is given a value of the status. The form has the following with time interval set to 400.
    Private Sub Form_Timer()
    If Me!txtStatus <> "" Then
    Me!txtStatus.Visible = Not Me.txtStatus.Visible
    End If
    end sub

    But when a query is running and a report is being prepared for previeving through separate modules, the textbox doesn't flash. I sensed it has something to do with SetFocus but don't know for sure or how to make it work.

    Would greatly appreciate any help/thoughts.
    Thanks.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Stick a DoEvents command in there and see what the effect is.

    Why would you want it to flash anyway?
    George
    Home | Blog

  3. #3
    Join Date
    Nov 2003
    Posts
    1,487
    Try This....

    Code:
    Private Sub Form_Timer()
       If Me!txtStatus <> "" Then
          Me!txtStatus.Visible = Not Me.txtStatus.Visible
          DoEvents    
       End If
    End Sub
    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by jodjim
    I've read all the threads about this subject but still can't seem to make it work for me.

    My form accepts input from user to run a query and reports. To inform the user of the progress of the processing, there's a textbox which is given a value of the status. The form has the following with time interval set to 400.
    Private Sub Form_Timer()
    If Me!txtStatus <> "" Then
    Me!txtStatus.Visible = Not Me.txtStatus.Visible
    End If
    end sub

    But when a query is running and a report is being prepared for previeving through separate modules, the textbox doesn't flash. I sensed it has something to do with SetFocus but don't know for sure or how to make it work.

    Would greatly appreciate any help/thoughts.
    Thanks.
    why do you need this code in a timer? its not going flash.. all that will happen is that the visibility will be flipped once if txtstatus contains soemthing...

    if you want to flash the control then you need to set the value outside that conditional test. maintian some form of state so that the flash is slow enough to be noticable.

    just out of curiosity what interval have you set, and have you checked to make sure the timer is working.. to do that I'd suggest you view the code, put a breakpoint on the relevant function (left click in the vertical strip adjacent to the code you want to set the breakpoint, or right click the line of code...)

    If, as I suspect, you only want to display txtstatus if a specific condition exists then better candidiate events for that are the form's on current, the control's on lostfocus, the form's and arguably the control's before update events.

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    A lot of times, issuing a Repaint command is needed to refresh the screen for flashing. For example, you could have 2 text boxes, one of them 1 color and the other another color (yellow). You can use code like CyberLynx showed and set one or the other text box to visible/invisible, issuing a repaint command.

    Also, if you'd like to see a progress bar work in action, check out this example:
    http://www.dbforums.com/showpost.php...5&postcount=55
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  6. #6
    Join Date
    Jun 2004
    Posts
    18
    The flashing textbox works until the line running an SQL query is encountered. It loooks like Access suspends other actions until the query is completed. I guess an un-flashing textbox for status would be good enough to inform the users.

    Thanks for your help.

  7. #7
    Join Date
    Nov 2003
    Posts
    1,487
    If you really want the effect (which is all it is - a attention grabber) then take a look at the API timer.

    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I use "wait windows" which just tell the user what's happening and asks the user to "please wait..."

    Adding more events just increases the overall execution time of the procedure
    George
    Home | Blog

  9. #9
    Join Date
    Dec 2006
    Location
    Momence, IL USA
    Posts
    56
    I also prefer the "please wait" box. If it might be a lengthy process, you may want to give the user some feedback so they know that the program is "doing something" and not locked up. I think dotNet makes it easy now to display asyncronous boxes like the "copying files" flying-folders thing.
    For VB6 and Access, the Animation control works well. You play some little AVI animation in a separate modal form that doesn't mess with your program's thread. Super simple - the only hard part is finding the right AVI file.
    Don't Bogart That Squishee!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •