# 2 timer events

#### jamesd

##### Board Regular
I have a form that requerys every 30 seconds using the forms timer event.
I would also like to have one of the labels flashing.
As both would need the on timer event , can this be done.
Ie
set Me![Text27].Visible = Not (Me![Text27].Visible) to 600 and
set docmd.requery to 30000

### Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Set the form's timer Interval to 1000 (for 1 second). Then set the code like this:

Rich (BB code):
``````Private Sub Form_Timer()
' static will keep the value and not reset
' on every event fire
Static lngCount As Long

' check to see if we have gotten to 30000 and,
' if so, do the requery
If lngCount = 30000 Then
Me.Requery
' reset the count to start over
lngCount = 0
End If

Me.Text27.Visible = Not Me.Text27.Visible
lngCount = lngCount + 1

End Sub``````

Thanks for this but sorry I can not get it to work

When I do as you say and past the code, the text flashes but the form does not requery ?

If lngCount >= 30000 Then 'Whats the odds of it being exactly 30000?
Me.Requery
' reset the count to start over
lngCount = 0
End If

If lngCount >= 30000 Then 'Whats the odds of it being exactly 30000?
100% if 1+1 = 2

Your statement is illogical. Think about it. The Timer event fires and, every time the Timer event fires, it adds one to the lngCount. So at some point it will equal 30,000 because it isn't based on an actual time, but on the number of times the Timer event fires. So your statement is completely incorrect.

Last edited:
Thanks for this but sorry I can not get it to work

When I do as you say and past the code, the text flashes but the form does not requery ?

Set a Watch and have it stop when lngCount = 30000. Then F8 through the code to see if it enters the If and does the requery. Also, make sure you aren't really trying to requery a subform on the main form. That would require

Me.SubformControlNameHere.Form.Requery

Me.Requery

(and where SubformControlNameHere is the name of the subform control which houses the subform on the parent form and not the name of the subform itself unless they are exactly the same. And that .Form. part is put in exactly as shown)

You are correct, with a number of 30,000 I figured that it was milliseconds, sorry. The form will not requery for 8 hours and 20 min+ -, maybe we should change the 30,000 to 30?

You are correct, with a number of 30,000 I figured that it was milliseconds, sorry. The form will not requery for 8 hours and 20 min+ -, maybe we should change the 30,000 to 30?

I did forget to account for the 1000 timer interval. Yes, the count should be changed to 30 and the check changed to 30.

Replies
9
Views
226
Replies
1
Views
281
Replies
2
Views
911
Replies
4
Views
465
Replies
7
Views
2K

1,203,263
Messages
6,054,446
Members
444,725
Latest member

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back