473,394 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Scheduling a Daily query to run at midnight

Hi,

I'm new to this forum. i'd like to setup a macro to run a query daily. Is there any way in access to do this?

thanks,

todd
Feb 19 '07 #1
9 20720
Hi,

same poster. i figured out one way. thought this might be helpful to others so i am posting how i did this. kind of cumbersome but it does the trick!

create a macro called autoexec. this macro will run automatically everytime you open the database. setwarnings to off, then program your query and don't forget to setwarnings back to on!

then use microsoft scheduler and schedule your database to open.

"To open Scheduled Tasks, click Start, click All Programs, point to Accessories, point to System Tools, and then click Scheduled Tasks."

your security level may prompt you to authorize opening access. this means that you must acknowledge that you wish to open access. to avoid this, go to tools, macro in access then set security level to low.

this puts you ahead of the game every day!
Feb 19 '07 #2
nico5038
3,080 Expert 2GB
You can now join the team here to help others :-)

That would have been the solution I would have proposed too. The only problem might be that the system isn't active when the job is scheduled. The only "safe" way would be to use a server and start the database from a service, but that might be too "heavy" when you're sure that the system is running.

Success !

Nic;o)
Feb 19 '07 #3
i see what you mean. I'm not totally clear on the resolution you've proposed but if i do come accross that problem, i will be sure to come a calling!

would be glad to help others, thanks! :)
Feb 19 '07 #4
NeoPa
32,556 Expert Mod 16PB
Rather than using a macro I would use a Form that you set to start automatically on Startup (Tools / Startup).
In the OnOpen event procedure for this form you can put VBA code to execute the query you want to run (An action query I presume).
Around that you can set warnings Off & back On again.
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub Form_Open(Cancel As Integer)
  5.   Call DoCmd.SetWarnings(False)
  6.   Call CurrentDb.QueryDefs!MyQuery.Execute
  7.   Call DoCmd.SetWarnings(True)
  8. End Sub
Remember, scheduling as standard, uses the SYSTEM account which is fine to run things locally but doesn't get network access.
Feb 20 '07 #5
that's definitely a more elegant solution! i don't have the IS background but perhaps one day...

but, i am one piece away from fully automating my job! i have created a macro to automatically send a report to a group of people. the macro or outlook has a security function that required a user to authorize any emails that access is trying to send. is there any way to turn this off?

thanks!!
Feb 22 '07 #6
NeoPa
32,556 Expert Mod 16PB
that's definitely a more elegant solution! i don't have the IS background but perhaps one day...

but, i am one piece away from fully automating my job! i have created a macro to automatically send a report to a group of people. the macro or outlook has a security function that required a user to authorize any emails that access is trying to send. is there any way to turn this off?

thanks!!
Todd,

Not sure what IS is :confused: sorry.
As to the question about the e-mail, I suggest you post this in a separate thread. I have the same issues you do (not a problem for me particularly as it's manned not scheduled), so I may see what answers come out of that one.

BTW this is a good example of why it's a good idea, as one expert may respond to one question but be very little use on another (Me :()
Feb 23 '07 #7
nico5038
3,080 Expert 2GB
You can use a Docmd.SendObject statement to trigger an email and suppress the warning message. There's a parameter that can be set to control this.

Nic;o)
Feb 25 '07 #8
Hi everyone,

I ran across an interesting program that can schedule macros to run in a MS Access database. It works by clicking a few buttons to set the date/time, then set the macro name to run. It doesn’t require using Windows Scheduled Tasks which is good for me. Check it out: http://macros.subpacket.com/

Regards,

Steven
May 15 '07 #9
You can use a Docmd.SendObject statement to trigger an email and suppress the warning message. There's a parameter that can be set to control this.

Nic;o)
Hi Nic. I use Docmd.SendObject to periodically send email from Access using a macro, but I have to use an external 'ClickYes' utility to get past the security warning message in Outlook that alerts an external app is trying to send a message. It would be great if there is a parameter in the SendObject statement in my Access module that would suppress this or ignore it, or send it a click yes, but darned if I can find it by reference to the help files. Were you referring to the Edit Message parameter or is there something else available in SendObject? Thanks in anticipation.
Jul 23 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Slavyan | last post by:
Does anyone knows any good scheduling controls (like daily, weekly, monthly, etc.) that are specifically written for .NET. Maybe there are controls that comes with Visual Studio.NET or something. ...
2
by: m3ckon | last post by:
Hi, I want to schedule a backup of three databases on a daily basis. I've written the code to run the 3 backups in TSQL and was wondering how best to automate this procedure? Should I put...
13
by: Mike | last post by:
Normally scheduling a job is a very elementary operation but for some hidden reason I've been unable to schedule a job which runs on a 28 day cycle, even though I have at least 16 other jobs...
4
by: Myth of Sisyphus\). | last post by:
I wish to run this script daily. Can this be scheduled? backup log shipmateDB with truncate_only G
3
by: Muscha | last post by:
Hi, In our application we need to have a high performance scheduling framework. We want to be able to say for item 21 do an update on such and such time. We will have around 1 million items of...
3
by: androoo | last post by:
Hi I would like some design advice for this problem. I host my website on a remote host and have an aspx page that searches daily for data and inputs data into the database. I run this page...
3
by: Jeff Young | last post by:
I am looking for documentation and sample code to create an outlook like calendar. I need to display 3 views(daily, weakly and monthly). Also msdn told me if I display certain information they...
0
by: Lemune | last post by:
Hello. I need some help on building my sms services application (using modem). My application is to do some scheduling task based on daily, weekly and monthly. On the daily the choice are everyday,...
5
by: Just_a_fan | last post by:
I tried to put an "on error" statement in a routine and got the message that I cannot user "on error" and a lamda or query expression in the same routine. Help does not list anything useful for...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.