X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Setting Timer Interval In A Subform From Another Form, Access 2003    
post Dec 4 2017, 09:52 PM

Posts: 37
Joined: 24-July 04
From: VA, USA

First of all, please don't laugh - I'm using MS Access 2003 because the customer still wants to use it.

I would like to set the timer interval of a sub form from another form. For example (these are bogus names) I have a main form (frmMain) which has a sub form embedded (frmSubForm). Based on operator input within frmSubForm, another form (frmGatherData) will open to allow some data input and when the operator closes (presses the SAVE button) I want frmGatherData to enable the Timer by setting the Timer Interval of frmSubForm.

I have tried several ways to do this but so far have not been successful. Here's what I've tried so far:

Form_frmMain!frmSubForm.TimerInterval = 300 - produces error: "Object doesn't support this property or method"

Forms("frmMain!frmSubForm").TimerInterval = 300 - produces error: "xxxx can't find the form 'frmMain!frmSubForm' referred to in the macro expression or Visual Basic code."

I have also tried using a Public sub in the frmSubForm, for example:
Public Sub setTimerInterval(nMSecs as Long)
me.TimerInterval = nMSecs
End Sub

And in the frmGatherData form on SAVE, I coded: Call setTimerInterval(1000) and get "Compile error: Sub or Function not defined"
Tried Forms("frmMain!frmSubForm").setTimerInterval (1000)" but that didn't work.

I'm out of ideas for now. I appreciate any guidance you may have.
Thanks so much.

Go to the top of the page
post Dec 4 2017, 10:07 PM

Access Wiki and Forums Moderator
Posts: 71,767
Joined: 19-June 07
From: SunnySandyEggo


Have you verified, though, if a Timer set on a subform will fire? Won't using the Timer on the main form work the same way?

Just curious...

Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
post Dec 5 2017, 12:31 PM

Posts: 925
Joined: 26-March 08
From: London, UK

I think you need:

Forms("frmMain").frmSubForm.Form.TimerInterval = 300

Where 'frmSubForm' is the name of the SubForm control on 'frmMain' if you're setting the 'frmSubForm' timer interval from 'frmGatherData'.

The attached example sets the timer interval of a sub form (in seconds) from a main form and so uses:


Where 'sctlSubForm' is the name of the SubForm control (see txtTimerInterval_Change on the main form).


Attached File(s)
Attached File  SetTimerInterval.zip ( 21.17K )Number of downloads: 4
Go to the top of the page

Custom Search
RSSSearch   Top   Lo-Fi    24th March 2018 - 04:28 PM