macro is not running automatically by a form in MS Access (1 Viewer)

CH HABIB

New member
Local time
Yesterday, 21:49
Joined
Apr 20, 2018
Messages
3
Hi everyone,
I make a macro which execute a procedure, the macro is working fine when i manually run it. But i want to run this macro every after one second, automatically. So I make a form and set the :
Time Interval=1000
On Timer=macro name
but the macro is not running after every one second.
I will be highly thankful to you if you help me to solve this issue.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:49
Joined
May 7, 2009
Messages
19,169
1 second is very fast. What is the code for your macro. If the procedure takes too much time executing it will take away the focus on your form.
I would suggest of instead of running the oroc from the macro, run it through vba (code builder) to have more control:

On Timer: [Event Procedure]
...
...




Private Sub Form_Timer()
Me.TimerInterval=0
' the called proc here
' add DoEvents inside tbe proc
Me.TimerInterval=1000
End Sub
 
Last edited:

CH HABIB

New member
Local time
Yesterday, 21:49
Joined
Apr 20, 2018
Messages
3
Thanks for your reply.
My form work properly when i restart my ms access software with my own steps that i tell you.
The macro is now running after each second, but there is a problem.
The macro is executing a function which is used to insert data, therefore, before execution it asks me the conformation to insert data, i want to get rid of this conformation.
Every time i want to click on yes to run the macro.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:49
Joined
May 7, 2009
Messages
19,169
On your function before the addinf of record code, add:

Docmd.setwarnings false


After the code that add the record, reset it to true:


Docmd.setwarnings true
 

CH HABIB

New member
Local time
Yesterday, 21:49
Joined
Apr 20, 2018
Messages
3
Yes, it is working.Thanks for helping me. I will be thankful to you if you accept my friend request.
 

Users who are viewing this thread

Top Bottom