Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I tell MS Access to do this at 6:00AM? 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a form in my Microsoft Access97, which I would like to use as an auto update form. What I would like to be able to do is set it so that the form will load a macro when the time is 6:00 AM. I have tried to do this using various code, and cannot seem to get the computer recognize that the time is 6:00 AM. Can someone tell me how to do this? <p>John Vogel<br><a href=mailto:johnvogel@homepage.com>johnvogel@homepage.com</a><br><a href= FreeDSL Service</a><br>[To a get FREE DSL Modem WITH FREE DSL Unlimited Internet Connection click the above link :)]
 
Well Windows NT has a Scheduler program<br>I think '98 has it too<br>Not sure about '95<br>Anyway you can schedule a program to launch at a specific time.<br>Then you can put a command like so in there:<br>&quot;C:\Microsoft Office97\Office\MSACCESS.EXE&quot; I:\EasyLabel\Sample.mdb /X OpenForm1<br><br>Which is the full path to Access then a blank space then the full path and name of the.MDB then a blank space and the &quot;/X&quot; and blank space an the name of a mcoro in that database. The macro name CANNOT have any blank spaces in it.<br>The macro runs whatever you want reports, you name it.<br><br>OK<br>
 
I have allready tried this, however that just opened up a whole new can of worms. It seems for some reason the scheduler cannot find the system file located on a network drive. I don't know why, and really haven't the time to figure it out, right now. I am looking for something that is quick so I can tell the boss that it is automated. <p>John Vogel<br><a href=mailto:johnvogel@homepage.com>johnvogel@homepage.com</a><br><a href= FreeDSL Service</a><br>[To a get FREE DSL Modem WITH FREE DSL Unlimited Internet Connection click the above link :)]
 
Create a form.<br><br>Set the following properties:<br><br><FONT FACE=monospace><br>On Timer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Event Procedure]<br>Timer Interval&nbsp;&nbsp;&nbsp;&nbsp;1000<br><br>Then add the following code:<br><br>Private Sub Form_Timer()<br><br>&nbsp;&nbsp;&nbsp;&nbsp;If Time() &gt; &quot;6:00 AM&quot; Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.RunMacro &quot;Macro1&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Me.TimerInterval = 0<br>&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>End Sub<br></font> <p>Jim Conrad<br><a href=mailto:jconrad3@visteon.com>jconrad3@visteon.com</a><br><a href= > </a><br>
 
What security rights did the scheduler have?&nbsp;&nbsp;If the service was running as &quot;Local system&quot; (default), then it can't access the network...
 
Oh wow! That was the problem. hehehe, I guess I should have posted that problem, well, I have gotten the autoupdate working, none-the-less, and it is working well... I used almost what Jim said (figured it out before I read it) However, since there are alot of times greater then 6:00 I realized I had to tell Access that the time should be after 6:00:00 AM and Before 6:00:05 AM. This works beutifully. Thanks for the help :)<br><br><br>Time &gt; <p>John Vogel<br><a href=mailto:johnvogel@homepage.com>johnvogel@homepage.com</a><br><a href= FreeDSL Service</a><br>[To a get FREE DSL Modem WITH FREE DSL Unlimited Internet Connection click the above link :)]
 
Making sure it only happens once is the purpose of the bit of code that sets the TimerInterval to zero, which stops the timer from running. <p>Jim Conrad<br><a href=mailto:jconrad3@visteon.com>jconrad3@visteon.com</a><br><a href= > </a><br>
 
To make it run once use a toggel Variable.<br>I created&nbsp;&nbsp;a utilities Table that has one field in it called &quot;DidItRun&quot; which is a Yes/No<br>In you code set it to True <br>And run your stuff<br>Then the next time the database is opened check to see if it is True or false.<br>Or course you have to set it to false at some point.<br>This is called toggling a variable.<br>
 
Why not just use this:<br><br><br><FONT FACE=monospace><br>If Time &gt; &quot;6:00:00 AM&quot; AND TIME &lt; &quot;6:00:05 AM&quot; THEN<br>&nbsp;...Run The Macro<br>END IF<br></font><br> <p>John Vogel<br><a href=mailto:johnvogel@homepage.com>johnvogel@homepage.com</a><br><a href= FreeDSL Service</a><br>[To a get FREE DSL Modem WITH FREE DSL Unlimited Internet Connection click the above link :)]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top