Timer intervall to set form invisible

G

Gina

Hi.

I am trying to set my main form (frmMain) to be invisible after a certain
time and the start-up form (frmStart) where a user input is required should
come up - lets say after 5 minutes of nothing happening..., maybe

I 've set the timer interval to 50000 in the Form_Current event of frmMain
..... but now I don't know how to go on.
after correct input the frmMain is opened and frmStart is invisible ...
maybe I should just use the screen saver .... but I wonder how this would be
carried out in a programme !!??
I would very grateful for help and idea(s) ? !!

Thanks,
Gina
 
G

Guest

The timer doesn't stop whether there is activity or not,

The Five minutes should be set in the Timer Interval property of the form,
five minutes will be represented with 300000,

You can do this:

On the on open and after update events of each form set the timer interval
of the main form to 0 and then back to 300000:

Private Sub Form_Open(Cancel As Integer)
Forms("MyForm").TimerInterval = 0
Forms("MyForm").TimerInterval = 300000
End Sub

On the ontimer event of the main form add this code:

Private Sub Form_Timer()
If Me.Visible Then
Me.Visible = False
Docmd.OpenForm "frmStart"
End If
End Sub

then have the form frmStart make the Form frmMain visible after the action
you expect from the user,



Forms!MainForm!Timer=0
 
G

Gina

Thank you .... jl5000

I was thinking about what is inactivity ... no mouse move, no clicks but
didn't get any further
as the timer went on and on ....
..... but your suggestion now sounds as if its the solution to my problem !!!

thanks again
Gina
 
G

Gina

Hi jl5000,

I have been playing around with your idea & code
I have the setback to TimerInterval = 0 and setItAgain to TimerInterval =
120000 (just to test) in the main forms Form_Click, Form_AfterUpdate,
Form_MouseMove events

Forms("frmMain").TimerInterval = 0
Forms("frmMain").TimerInterval = 120000

further I put the above code into each of the 3 subforms events like above
I put a halt on the lines in the events .... they do not fire... :(
I do not know when those events fire at all !!!
Is there a way to ask whether any control of main and subforms has got some
events - if so and then do something within the time set by the timer
events like click, keypress, mousemove .... without having to type it in
each single control - oh dear ;-)

users may open it and just read some info and click around on the controls -
searching, retrieving etc without adding, editing or deleting records ....
so the form may not get updated at all ??!!
to make a long story short - it still doesn't set back the timer ....

This is in the frmMain's Timer event:
If Me.Visible Then
Form_frmStart.Visible = True
Form_frmStart.txtUserName.SetFocus
Me.Visible = False
End If

Think I can't use it this way .... the user will have to type in the
password each time the timer has finished ... despite someone is working
with the programme..., oh please ... I would thrtough such a programme into
the bin!!
so is there any other way ..... ???

any help, ideas or links highly appreciated !!

Thanks,
Gina
 
G

Guest

For subforms try the On Enter event,

also

-You can create a function with the code in a generic module

Function Check_Activity_Timer()
Forms("frmMain").TimerInterval = 0
Forms("frmMain").TimerInterval = 120000
End Function

-create a macro with action runcode, Check_Activity_Timer
-Call that macro in the on open events on forms and on Enter event in
subforms, so you do not have to copy the code to every form,
 
G

Guest

Try this function as described in my prev post


Function Check_Activity()
Forms("frmMain").TimerInterval = 0
Forms("frmMain").refresh
Forms("frmMain").TimerInterval = 120000
Forms("frmMain").refresh
End Function
 
G

Gina

Thanks jl5000

will try what you suggested ..... I just tried to use a picture as
background ... so I cut all the controls of a test form inserted the picture
pasted the controls and used the mousemove and click events of the picture
...... so the timer as you first suggested works !!!!

what I do not understand is why the events of the frmMain (the one without
picture) Form_Click, Form_MouseMove do not fire ..... am I doing something
wrong or am I thinking wrong ???

Thanks again,
Gina
 
G

Gina

jl5000,

I created the macro .... could not find an onenter event for forms (or
subforms)
so I changed the function to refresh the main form after each timerInterval
setting ....

put it as before in all the form events (I thought or hoped get called at
some point in time !!! - well ... obviously not)

so now ... as it worked fine with the picture .... i created a picture
filled with the forms background just a few pixels in width and height ....

inserted this tiny picture into a picframe and on load: picture.width =
form.insidewidth .. the height I have to size in design view

I am calling the function below on click and mousemove of each forms picture
......unbelievable: it works ....
Function Check_Activity_Timer()
Forms("frmMain").TimerInterval = 0
Forms("frmMain").TimerInterval = 120000
End Function

downside of it:
1. it's only a trick (and therefore not really satisfying)
2. I have to cut all the controls of each subform, insert the pic, paste the
controls again .... (there must be sth. wrong with access ... if it doesn't
react on Form_Click and Form_MouseMove etc


On the other hand I am glad it somehow works at all

Big Thanks jl5000 for your hands-on help

Gina
 
G

Gina

Hi jl5000

just wanted to complete how I am getting on re the above
found out that using the parts of a form (head, detail and foot) and assign
your function to click and mousemove evnets of each main and subform (parts)
works .....
deary me .... finally ... without a trick!!!

Thank you!!

Gina
 

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