By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,028 Members | 1,733 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,028 IT Pros & Developers. It's quick & easy.

OnTimer ?

P: n/a
Ron
Hi All,

Have just discovered this great tool to hide a form if it hasn't been used
in awhile. However, I have a form that can call up another screen (modal)
that can then call up another one (again, modal). All done via command
buttons. Meanwhile, if there's been no activity on the main screen, it
hides itself. I'd rather have it hide itself after the allotted time has
run down ONLY IF it's the top form and hasn't already called another. Any
way to accomplish that?

This should be an easy one but I've looked in the help files and can't seem
to locate what I need.

TIA
ron
Jul 27 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a

Ron wrote:
Hi All,

Have just discovered this great tool to hide a form if it hasn't been used
in awhile. However, I have a form that can call up another screen (modal)
that can then call up another one (again, modal). All done via command
buttons. Meanwhile, if there's been no activity on the main screen, it
hides itself. I'd rather have it hide itself after the allotted time has
run down ONLY IF it's the top form and hasn't already called another. Any
way to accomplish that?

This should be an easy one but I've looked in the help files and can't seem
to locate what I need.

TIA
ron
the problem with modal forms is TTBOMK, they cause your code to stop
running. (it's awaiting a response from the user). you could mock up a
modal form using a normal form and then including an event in the
OnTimer to close the form.

Jul 27 '06 #2

P: n/a
Ron

<pi********@hotmail.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
>
Ron wrote:
>Hi All,

Have just discovered this great tool to hide a form if it hasn't been
used
in awhile. However, I have a form that can call up another screen
(modal)
that can then call up another one (again, modal). All done via command
buttons. Meanwhile, if there's been no activity on the main screen, it
hides itself. I'd rather have it hide itself after the allotted time has
run down ONLY IF it's the top form and hasn't already called another.
Any
way to accomplish that?

This should be an easy one but I've looked in the help files and can't
seem
to locate what I need.

TIA
ron

the problem with modal forms is TTBOMK, they cause your code to stop
running. (it's awaiting a response from the user). you could mock up a
modal form using a normal form and then including an event in the
OnTimer to close the form.
Hmmm...

If the modal forms on top of the 1st form (which isn't modal) stop the 1st
form's code from running, how can the first form's OnTimer code that says to
hide the 1st form run?

Am I being clear?

Thanks
ron
Jul 27 '06 #3

P: n/a
Ron wrote:
If the modal forms on top of the 1st form (which isn't modal) stop the 1st
form's code from running, how can the first form's OnTimer code that says to
hide the 1st form run?
It sounds like the first form is a menu of some sort.

What about on the pressing of a button that opens the various forms,
that you include the following:

me.timerinterval = 0

This stops the timer for the first form.

In the on close event of the various forms that are generated, you can have:

Forms.frmFirstForm.TimerInterval = 500 (or whatever)

and this will start the timer again.

If it's possible to have multiple modal or whaterver forms open past the
first one, plop a sub like this into a standard module and put the sub
into the on close event of the modal/other forms (air code):

Sub sRestartMainFormTimer()

dim f as Access.Form
dim intNotMainForm as integer

intNotMainForm = 0

For each f in access.Forms

if f.name <"MainFormName" then intNotMainForm = intNotMainForm+1

Next

if intNotMainForm = 0 then
'No other forms other than main form open
Forms.frmFirstForm.TimerInterval = 500 (or whatever)
end if

End Sub
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Jul 27 '06 #4

P: n/a
Ron

"Tim Marshall" <TI****@PurplePandaChasers.Moertheriumwrote in message
news:ea**********@coranto.ucs.mun.ca...
Ron wrote:
>If the modal forms on top of the 1st form (which isn't modal) stop the
1st form's code from running, how can the first form's OnTimer code that
says to hide the 1st form run?

It sounds like the first form is a menu of some sort.

What about on the pressing of a button that opens the various forms, that
you include the following:

me.timerinterval = 0

This stops the timer for the first form.

In the on close event of the various forms that are generated, you can
have:

Forms.frmFirstForm.TimerInterval = 500 (or whatever)

and this will start the timer again.
Thanks for the above. I worked it into what I needed and it works, to a
degree. I set the interveral to about 15 seconds to test everything and was
surprised to find that clicking the tabs on the form I want to "hide"
doesn't reset the counter. Nor, does moving to different records (I use
another navigation set of arrows, etc rather than the default ones). So,
seems like this really won't do me much good. I'll either have to set the
time so high as to be useless, or constantly have the form disappear and
have to call it up again. Boy, it's always something.

Oh, well. Again, your idea worked, it's just that probably the whole
concept isn't going to serve my purpose.

Thanks for your efforts though--I appreciate it.
ron
If it's possible to have multiple modal or whaterver forms open past the
first one, plop a sub like this into a standard module and put the sub
into the on close event of the modal/other forms (air code):

Sub sRestartMainFormTimer()

dim f as Access.Form
dim intNotMainForm as integer

intNotMainForm = 0

For each f in access.Forms

if f.name <"MainFormName" then intNotMainForm = intNotMainForm+1

Next

if intNotMainForm = 0 then
'No other forms other than main form open
Forms.frmFirstForm.TimerInterval = 500 (or whatever)
end if

End Sub
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me

Jul 28 '06 #5

P: n/a
Ron wrote:
Oh, well. Again, your idea worked, it's just that probably the whole
concept isn't going to serve my purpose.
I always find the sorts of features you want to be a bit of a think
through. If I were to do this, I'd also have a integer at the form level:

dim intTimeCounter as Integer

which would advance with each firing of the timer interval. When
intTimeCounter reached a certain level, something would happen (I do
this all the time for simple animations on splash forms and what have
you). You could have the counter public:

Public intTimeCounter as Integer

within the main form. Thus, your reset function, which I presented,
could also have the following line:

Forms.frmFirstForm.intTimeCounter = 0

to reset the works.

In your case, set the timer interval to say, 5 seconds, ie, 5000.

SOme of the code in the main form module would look like (air code):

'^^^^^^^^ frmFirstForm Module ^^^^^^^^^^^^^^^^^^
Option Compare Database
Option Explicit

Public intTimeCounter as Integer 'public in scope so it can be changed
from other forms

Sub whatever
end sub

Private Sub Form_Timer()

intTimeCounter = intTimeCounter + 1

if intTimeCounter = 3 then '15 seconds has been reached...
docmd.close acform, "frmFirstForm"
end if

End Sub

Private Sub btnOpenAForm_Click()

intTimeCounter = 0
me.timerinterval = 0

End sub
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

On your modal or whatever forms, use the sort of proc I mentioned in the
last post with the additional Forms.frmFirstForm.intTimeCounter = 0 line.

As a comment, I'm not sure why you'd want a main form (like a menu or
the access wizard "switchboard") to stay open or at least visible while
you've another form open. I'd just close the main form or make it
invisible and use controls on it for storing values or what have you.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Jul 28 '06 #6

P: n/a
Hi Ron,

In fact you want to close main form when this is the only open form?
In that case you can check for this condition with:

if (Forms.Count = 1) and (Forms(0).Name = "MyMainForm") then
DoCmd.Close acForm, "MyMainForm"
endif

HBInc.

Ron wrote:
Hi All,

Have just discovered this great tool to hide a form if it hasn't been used
in awhile. However, I have a form that can call up another screen (modal)
that can then call up another one (again, modal). All done via command
buttons. Meanwhile, if there's been no activity on the main screen, it
hides itself. I'd rather have it hide itself after the allotted time has
run down ONLY IF it's the top form and hasn't already called another. Any
way to accomplish that?

This should be an easy one but I've looked in the help files and can't seem
to locate what I need.

TIA
ron
Jul 28 '06 #7

P: n/a
Ron
Hi,

Well, actually what I wanted to do was hide the screen (visible = false)
rather than close it. And the reason I wanted to do that is, this main form
is kinda a starting point for a bunch of work that can be done on each
client. Call up the client needed, do work on that one, call up the next,
etc. And, there is sensitive data on the main client form, phone
numbers/tax id's, etc. I know my input folks, and they'll go to lunch or
something and leave the client form on the screen for all who walk by to
see. Not a good thing.

But, since this interval timer thing didn't work the way I thought it would
(interval wasn't set back to beginning if clerk clicked on tabs on the form,
nor the navigation arrows for the next client, etc), I decided not even to
use the suggestions here. Too much hassle to change everything at this
stage of the gameplan.

Instead, what I did was "strongly suggested" that users set the windows
screen saver to about a minute or 2. That solution seems to be working fine
and my users are happy. And, if I want to really protect things, I can
always activate the user password trick on the screen saver. But again,
even that could be more hassle than it's worth.

Thanks for the responses though. I'm most thankful for the time and energy
everyone puts into answering questions here. I've learned a bunch!

Hang in
ron

"hbinc" <j.********@hccnet.nlwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Hi Ron,

In fact you want to close main form when this is the only open form?
In that case you can check for this condition with:

if (Forms.Count = 1) and (Forms(0).Name = "MyMainForm") then
DoCmd.Close acForm, "MyMainForm"
endif

HBInc.

Ron wrote:
>Hi All,

Have just discovered this great tool to hide a form if it hasn't been
used
in awhile. However, I have a form that can call up another screen
(modal)
that can then call up another one (again, modal). All done via command
buttons. Meanwhile, if there's been no activity on the main screen, it
hides itself. I'd rather have it hide itself after the allotted time has
run down ONLY IF it's the top form and hasn't already called another.
Any
way to accomplish that?

This should be an easy one but I've looked in the help files and can't
seem
to locate what I need.

TIA
ron

Jul 29 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.