VBS… How to change focus to MS Access?

I'm trying to use the sendkey command via vbs to an existing access db, but I can't figure out how to change the focus to it.  I tried the below code.
Dim Act :Set Act = CreateObject("Wscript.Shell")
Act.MSACCESS.activate
'Also tried Act.AppActivate("MSACCESS")
WScript.Sleep 1000
Act.SendKeys "username"
Act.SendKeys "{TAB}"
Act.SendKeys "password"
Act.SendKeys "{ENTER}"

Open in new window

kbay808Asked:
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.

aikimarkCommented:
AppActivate is what you will use, but you need to supply the leading characters on the title bar of the open Access application.
kbay808Author Commented:
The name of the DB is QMT.  Where do I put the "Q"?
Act.AppActivate("MSACCESS")

Open in new window

aikimarkCommented:
with the database open, what is the text in the title bar?
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

kbay808Author Commented:
I just realized that it’s not an Access window.  The DB is linked to tables on another network and it requires authentication.  The window that I need to focus on is the “Windows Security” window, but it would be good to know how to focus on a form.  If the form name was "Menu", what would the code look like?
aikimarkCommented:
the string parameter for the AppActivate statement/method would be "Menu"

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
kbay808Author Commented:
Like this?
Act.AppActivate("Menu")

Open in new window

kbay808Author Commented:
That works perfect for any window.  Thank you very much.
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
VB Script

From novice to tech pro — start learning today.