Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
929 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

610 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