Results 1 to 13 of 13
  1. #1
    AAAndy is offline Advanced Beginner
    Windows 7 64bit Access 2013 32bit
    Join Date
    Aug 2016
    Posts
    68

    How can I display a label for about 3 seconds?

    How can I display a label or make it visible for about 3 seconds?




    Code:
    Me.Label_Saved.Visible = True

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You can use a counter - in a "Do Until x > 1000, x=x+1" type of loop.

    Or you can use Now(), calculate how many seconds have passed and stop after 3.

  3. #3
    AAAndy is offline Advanced Beginner
    Windows 7 64bit Access 2013 32bit
    Join Date
    Aug 2016
    Posts
    68
    Quote Originally Posted by aytee111 View Post
    You can use a counter - in a "Do Until x > 1000, x=x+1" type of loop.

    Or you can use Now(), calculate how many seconds have passed and stop after 3.
    I tried the below but it did not work

    Code:
    Dim index As Long
    index = 1
    
    
    Do
        Me.Label_Saved.Visible = True
        index = index + 1
    Loop Until index = 50000
    
    
    Me.Label_Saved.Visible = False

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Code:
    Dim x as Integer
    Do Until x > 5000
        x = x + 1
    Loop

  5. #5
    AAAndy is offline Advanced Beginner
    Windows 7 64bit Access 2013 32bit
    Join Date
    Aug 2016
    Posts
    68
    Below also does not work. Will not display a label

    Code:
    Dim x As Integer
    
    
    Do Until x > 5000
        x = x + 1
        Me.Label_Saved.Visible = True
    Loop
    
    
    Me.Label_Saved.Visible = False

  6. #6
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    What does "does not work" mean exactly? Also, you only have to set the visible to true once, not every time. And is 5000 the right amount? You will have to play with that.

  7. #7
    AAAndy is offline Advanced Beginner
    Windows 7 64bit Access 2013 32bit
    Join Date
    Aug 2016
    Posts
    68
    the label does not display. How would you alter the code?

  8. #8
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I'm not sure why it isn't displaying.

    I would put the visible=true statement before the loop starts.

  9. #9
    AAAndy is offline Advanced Beginner
    Windows 7 64bit Access 2013 32bit
    Join Date
    Aug 2016
    Posts
    68
    that does not work

  10. #10
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    In the property sheet or on the form load you need to set the Timer value to 3000

    Then, in the Form's Timer Event ...
    Code:
    Static intOff As Integer
    If intOff = -1 Then
        Me.Label_Saved.Visible = True
    Else
        Me.Label_Saved.Visible = False
    End If
    intOff = Not intOff

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    If I'm a betting man, and since I live in Nevada I have to be , I'm betting the loops of 5 or 50k are executed so quickly you don't notice it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209
    Do a trial run with a delay loop to test how to hide a label after 5 seconds.
    1. Create a Command Button on a Form.
    2. Change the Name property value to Command7
    3. Create a Label on the Form.
    4. Change the Name property value to Label6.
    5. Change the Caption property value to some text you like.
    6. Copy and paste the following code into the Form Module.
    Code:
    Private Sub Command7_Click()
    Dim t
    t = Timer
        Do While Timer <= t + 5 'wait for 5 seconds
           DoEvents
        Loop
        Me.Label6.Visible = False
    
    End Sub
    7. Save the Form and open it in Normal View.
    8. Click on the Command Button and watch the label.

    After 5 seconds the label will disappear from the Form.

    Another trick you can find here as how to animate a (flashing a label) Label when the search for a text is successful.: http://www.msaccesstips.com/2009/04/...earch-success/
    Last edited by apr pillai; 09-15-2016 at 11:47 AM. Reason: addition of text.

  13. #13
    darwish is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    26
    Dear

    Try This. it works for me

    'Create a function for looping the time as below

    Public Sub PauseFor(ByVal Period As Double)
    Dim Start As Double
    Start = Timer
    While (Timer - Start) < Period
    DoEvents
    Wend
    End Sub


    'in your code when you need to show the label for 3 sec do the following:

    ........
    ........

    label.visible = true;
    PauseFor 3;
    label.visible = false;

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

Similar Threads

  1. Replies: 1
    Last Post: 04-25-2014, 11:41 AM
  2. Filtering records to display on Label
    By drunkenneo in forum Modules
    Replies: 2
    Last Post: 04-01-2014, 02:09 AM
  3. Replies: 3
    Last Post: 09-14-2012, 03:35 PM
  4. Convert seconds to DD:HH:MM:SS
    By rockcliff15 in forum Access
    Replies: 6
    Last Post: 04-23-2012, 01:27 PM
  5. Replies: 5
    Last Post: 06-28-2011, 06:40 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