473,322 Members | 1,719 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,322 software developers and data experts.

Run macro automatically every night

Hi Experts,

I just want to know if it's possible to schedule run macro in access 2003 automatically every night, so users can see the updated data early in the morning without have to wait for me to update it first? I have an access database that I have to manually run the macro everyday. If yes, could you please help me out? Thank you so much
Jul 18 '07 #1
5 40649
ADezii
8,834 Expert 8TB
Hi Experts,

I just want to know if it's possible to schedule run macro in access 2003 automatically every night, so users can see the updated data early in the morning without have to wait for me to update it first? I have an access database that I have to manually run the macro everyday. If yes, could you please help me out? Thank you so much
I've never actually done this, and I didn't have the time to test it, but you should be able to run Microsoft Access with the /x macroname Command Line Option as a Daily Scheduled Task if you are using Windows XP. Here is the procedure:
  1. Start Menu
  2. Programs
  3. Accessories
  4. System Tools
  5. Scheduled Tasks
  6. Add a Scdeduled Task
  7. Select Program to Run
  8. Add any necessary Parameters
  9. Select Open the Advance Properties Dialog when finished
  10. Specify the /x macroname Command Line Option on the Command Line
Jul 19 '07 #2
I've never actually done this, and I didn't have the time to test it, but you should be able to run Microsoft Access with the /x macroname Command Line Option as a Daily Scheduled Task if you are using Windows XP. Here is the procedure:
  1. Start Menu
  2. Programs
  3. Accessories
  4. System Tools
  5. Scheduled Tasks
  6. Add a Scdeduled Task
  7. Select Program to Run
  8. Add any necessary Parameters
  9. Select Open the Advance Properties Dialog when finished
  10. Specify the /x macroname Command Line Option on the Command Line
Thank you so much for the reply. I went up to no. 9, but I'm not so sure where should I put the macroname. I didn't see the command line option and should I just put my macro name on the database? Please help. Thank you.
Jul 19 '07 #3
ADezii
8,834 Expert 8TB
Thank you so much for the reply. I went up to no. 9, but I'm not so sure where should I put the macroname. I didn't see the command line option and should I just put my macro name on the database? Please help. Thank you.
This may be a better alternative for you:
  1. Set the Scheduler to Open your Database at a specific time. The Command Line to Open the DB would be something like this:
    Expand|Select|Wrap|Line Numbers
    1. "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "C:\Test\Test Database.mdb"
  2. In your Opening Form, set the Timer Interval of the Form to an appropriate value such as 6000 (6 seconds).
  3. Place the following code in the Timer() Event of the Main Form. The following code will Run a Macro at the time as indicated by the Scheduler, wait for the Timer Interval Delay, then Exit the Database and Access.
    Static intCounter As Integer

    Expand|Select|Wrap|Line Numbers
    1. Private Sub Form_Timer()
    2. If intCounter > 1 Then
    3.   Me.TimerInterval = 0
    4.   DoCmd.Quit
    5. Else
    6.   DoCmd.RunMacro "mcrTest"
    7. End If
    8.  
    9. intCounter = intCounter + 1
    10. End Sub
Jul 19 '07 #4
This may be a better alternative for you:
  1. Set the Scheduler to Open your Database at a specific time. The Command Line to Open the DB would be something like this:
    Expand|Select|Wrap|Line Numbers
    1. "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "C:\Test\Test Database.mdb"
  2. In your Opening Form, set the Timer Interval of the Form to an appropriate value such as 6000 (6 seconds).
  3. Place the following code in the Timer() Event of the Main Form. The following code will Run a Macro at the time as indicated by the Scheduler, wait for the Timer Interval Delay, then Exit the Database and Access.
    Static intCounter As Integer

    Expand|Select|Wrap|Line Numbers
    1. Private Sub Form_Timer()
    2. If intCounter > 1 Then
    3.   Me.TimerInterval = 0
    4.   DoCmd.Quit
    5. Else
    6.   DoCmd.RunMacro "mcrTest"
    7. End If
    8.  
    9. intCounter = intCounter + 1
    10. End Sub
Thank you so much for the prompt response and Yes it worked !!!
Jul 19 '07 #5
ADezii
8,834 Expert 8TB
Thank you so much for the prompt response and Yes it worked !!!
Glad it worked for you.
Jul 19 '07 #6

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

Similar topics

1
by: Graham | last post by:
We use buildit to automatically build all of our solutions every night. In C# we are able to call a batch file for the post build event and sign the assembly for the GAC using our private/public...
1
by: Jakey Jake | last post by:
Hi, I need some HTML / Javascript that will automatically reload or refresh my page after 5 minutes. I have tried Meta in HTML but I cant access the <Head> as its not entirely my page. Can...
4
by: failing | last post by:
I need to write a VB Macro that will run automatically every hour. Any ideas? Is this possible?
0
by: blackjackkiller | last post by:
Hi Need help in automating the report.Let me give the explanation what i need that might help u in understanding it. 1 need excel macro to run a query to pull data from sql server for specific...
2
by: jmartmem | last post by:
Greetings, I have several Access 2007 reports that I regularly export to individual PDF flat files on a web server. I've successfuly created a module sub to export the reports using the...
8
by: kini113 | last post by:
I want to update my database every night at 10pm. I have a Macro that runs all of the queries needed to update the database (which is also saved as a VBA module) and an AutoExec Macro to runs the...
4
by: kini113 | last post by:
I want to update my MS Access database every night at 10pm. I have a Macro that runs all of the queries needed to update the database (which is also saved as a VBA module) and an AutoExec Macro to...
2
by: Yolly | last post by:
i have an access database that needs a macro timer to close down the database automatically.run every night. I don't know how to code this macro timer in VBA. Please help! Yolly
1
by: Jian Liang | last post by:
Hi, I have a PHP page named INPUT.php to let respondent answer questions. I have a function named SAVE() save their input into database. I need to call SAVE() every 5 mins automatically . How can...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.