How can I display a label or make it visible for about 3 seconds?
Code:Me.Label_Saved.Visible = True
How can I display a label or make it visible for about 3 seconds?
Code:Me.Label_Saved.Visible = True
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
Code:Dim x as Integer Do Until x > 5000 x = x + 1 Loop
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
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.
the label does not display. How would you alter the code?
I'm not sure why it isn't displaying.
I would put the visible=true statement before the loop starts.
that does not work
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
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.
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.
7. Save the Form and open it in Normal View.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
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.
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;