Solved

Is there a way to run a VBA code automatically at a specific time intervals without using the On Timer on a form?

Posted on 2003-12-02
10
917 Views
Last Modified: 2007-12-19
Hi Experts,

Is there a way to run a VBA code automatically at a specific time intervals without using the On Timer on a form?

I have a VBA code  that activates the send/receive of Outlook. The VBA looks for emails with a specific subject line and reads it into a table. I want to run the VBA in the background regardless if a form is open or not. That's why I do not want to place the VBA code in the On Timer of a form. Is this possible and how can it be accomplished?

Thanks
0
Comment
Question by:indyng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 23

Expert Comment

by:heer2351
ID: 9862317
It is doable using the SetTimer API but it is not simple.

I would recommend opening a hidden form with a timer automatically when the database opens.
0
 
LVL 7

Expert Comment

by:wsteegmans
ID: 9862332
0
 
LVL 32

Expert Comment

by:jadedata
ID: 9862336
Hey indyng!

  Yes.  Set the Timer Inteval on the for to an appropriate number of milliseconds

  Use the Form_Timer event to trigger a look at the system clock,... Time()

  if the Time() is right, run your function/subroutine
regards
Jack
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:DMurray
ID: 9862339
I'm not aware of any other way.

Why not have a timer on a hidden form in the background, so no one can see it.

I have timers that do similiar things, what I do is when my database opens, in my autoexec macro I get it to open a form "startup" in hidden mode. Therefore, user cannot see it, but the timers still run.

DMurray
0
 
LVL 1

Author Comment

by:indyng
ID: 9862818
How do I create an autoexec macro? And how do I hide a form? Thanks
0
 
LVL 1

Author Comment

by:indyng
ID: 9862822
If the focus is not on the hidden form will the On Timer still initiate? Thanks
0
 
LVL 23

Accepted Solution

by:
heer2351 earned 500 total points
ID: 9862845
>>How do I create an autoexec macro? And how do I hide a form?
Goto the macros tab
Create a new macro
Make it open your form (Action: OpenForm, windowMode = Hidden)
Call this macro AutoExec it will run each time the database is opened.

>>If the focus is not on the hidden form will the On Timer still initiate?
Yep the timer will still work.

0
 
LVL 1

Author Comment

by:indyng
ID: 9862916
Thanks for the advice!
0
 
LVL 3

Expert Comment

by:DMurray
ID: 9863390
Damn no points for me?

:(

DMurray
0
 
LVL 3

Expert Comment

by:DMurray
ID: 9863397
ooops

Sorry, I thought I had originally suggested the hidden form. But I note that Heer did originally. Sorry for that..

DMurray
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question