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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't run module automatically

Status
Not open for further replies.

rfcc

IS-IT--Management
Nov 17, 2003
15
US
I have two questions. I have a module I made in Access 97 that imports a file and appends it to a database which needs to be done daily. The function in the module works if I open the module and run it, but the run button is grayed-out on the module tab, so I can't run it without opening it. Does someone know why the run button is gray? I can put the code on here if needed, it's pretty short.

If I can get the function to run outside the module window, I'd like to schedule it to run every morning. I was going to use windows scheduler to see if I could call the function (or a macro calling the function) every day. Does anyone know if this is possible?


thank you,
Rob Cobb
 
Hi
I think that one problem may solve the other! The way I would do this is with an autoexec macro (which runs on opening the database). The macro can be used to run your code, if it is a function, otherwise you will need to create a function to call your code. The database can be opened automatically on a scheduler, then the macro will run. Hope this gives you some ideas.
 
Thanks alot, this works. If you or anyone else could point me in the right direction, I'd like to add something to the code that would check to see if data for a date had already been added yet, so I could make the function stop if it had. Can someone tell me of a function that would look at a field and give a true or false if it contained a certain date?
 
Hi
The Dlookup function could be what you need.
 
How are ya rfcc . . . . .

You don't run modules, you run functions/routines in modules . . . [purple]this is why[/purple]. You must have added the button to the menu/toolbar, as it normally doesn't exist in the modules window.

You can use the windows [purple]Task Scheduler[/purple] to:
[ol][li]Open the database[/li].
[li]Run your function ([blue]Remou's suggestion[/blue]).[/li]
[li]Close the database (if necessary).[/li][/ol]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top