Execute a command button in MS Access using Task Scheduler

I want to schedule a onclick event command button to fire up automatically in MS Access using Task Scheduler.

Please help.

Thank you.
Queennie LAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Nick67Commented:
Others will chime in, but MS Access runs from a logged-in user account only.
Getting it to run in a bulletproof fashion via the Task Scheduler is possible but fraught with ways to go wrong.

What is in the OnClick event?
Will Access remain open?
Will the user always be logged on?
Will Access remain the active task?

You need to add a LOT more detail to your question!
Jeffrey CoachmanMIS LiasonCommented:
You need to add a LOT more detail to your question!
Agree with Nick...

Also note that you must carefully consider what you want to happen if:
The task scheduler fails to run (for any reason)
The code fails to run (for any reason)
The PC is powered down.

Remember that there is no real "notification" in the task scheduler to alert you if something goes wrong...
In some cases you may never know the task failed, ...possibly letting you go for months with invalid data...

JeffCoachman
Queennie LAuthor Commented:
Hello Nick,

I have a code in vb.net that use "autoimport" in task scheduler but I don't know how to do this in MS Access.

Code in VB.net:

Private gAutoImport As Boolean

Private Sub frmimport_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load

		If LCase(VB.Command()) = "autoimport" Then
            gAutoImport = True
			Call cmdImport_Click(cmdImport, New System.EventArgs())
			Me.Close()
			End
		Else
            gAutoImport = False
		End If
	End Sub

Open in new window



Then I created a Task to auto run the command button. This how I created in Task Scheduler:

Action Tab:
Start a program

Program/Script:
\\network\applications\Program.exe

Add arguments:
autoimport  =>>> this will click the command button in my Program.exe


I hope this makes sense.

Thank you.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Here's a short video on the different ways you can fire up Access and run some code:

http://www.experts-exchange.com/videos/537/MS-Access-Different-Ways-to-Start-Up-a-Database.html

Jim.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
...So you need to make sure that you have "rock solid" error handling in all of your code...
Queennie LAuthor Commented:
I got it working.

Thanks.
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Good to hear!

Jim.
Queennie LAuthor Commented:
Thanks Jim.

I gave you the credit since the video gave me an idea how to fire the command button.

I really appreciate your help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.