OnTimer event not called when form opened from code

C

Chrisso

Hi All

I have a form that tells the user that the DB is updating. I have
programmed an OnTimer event to make some of the code flash to draw the
users attention:

Private Sub Form_Timer()
With Me.lblUpdating
.ForeColor = (IIf(.ForeColor = vbRed, vbBlack, vbRed))
End With
End Sub

When I view it in form mode from the database window it displays
perfect and the text flashes nicely.

However - when I open it from a sub in a module before I run the
update the text does not flash at all as though the OnTimer event is
never called. I put a debug Stop in the OnTimer and this confirms that
the event is not called!

I am just opening the form in a very straight forward fashion:

' tell the user what is happening:
DoCmd.OpenForm "frmTADUpdating"

Any ideas what I am doing wrong here?

Thanks in advance for any ideas,
Chrisso
 
D

Damon Heron

The only reason it would not be called is if the Timer Interval is set to 0
on the form's property sheet.
What do you have it set as? Remember its in millisecs, so 500 would be 1/2
second.

Damon
 
J

JonWayn

I dont know if you have other codes following the OpenForm statement but,
since you need to get the user's attention, I'd assume you want all other
codes halted until the form is disposed of. In that regard, I'd suggest
changing the OpenForm statement so that the form opens in dialog mode. IOW,
set the 2nd to last argument of the OpenForm Statement to acDialog. That was
if other codes that tie up your processor are being executed after the
opening of the form, they are suspended until the form goes away. That's the
first thing that comes to mind. The other unlikely cause is you may be
setting the form TimerInterval property to 0 somewhere in your sub.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top