Cannot get focus on form windoe from MS Access DB applicatio

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
HansJona
Newbie
Posts: 3
Joined: Sat Aug 12, 2006 8:26 am

Cannot get focus on form windoe from MS Access DB applicatio

Post by HansJona » Sat Aug 12, 2006 8:33 am

I experience a problem when I want to automate my MS Access application.
In this application i programmed a routine which updates data from a xls file. The user is prompted with a MSAccess Form Window called "frmInport"
When I try to use this with Macro it will not work. Somehow the system does not recognize this window. Althoug in Task Manager it is shown as task. Any idea? Is there a known issue wiht MS Access Sub Windows accessability? Thanks for replying!

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Sat Aug 12, 2006 2:11 pm

I created a test by creating a form called ClientData on a database of the same name. Then opened IE to CNN.com and ran this script. I had no problems changing focus even if the form window was maximized inside MSAccess...

Label>ResetFocus
wait>2
Setfocus>CNN*
wait>2
setfocus>ClientData*
wait>2
goto>ResetFocus

I'm sure you've checked, but did you spell the window name correctly? Is this a standard MSAccess form a user could create with the form wizard? Have you included the * at the end of the window name just in case you have a space or other unseen character in the window name?

Could you post some of your code here for us to see?

Thanks, I hope we can help.

HansJona
Newbie
Posts: 3
Joined: Sat Aug 12, 2006 8:26 am

Post by HansJona » Sat Aug 12, 2006 4:00 pm

Thanks for the reply. In the meantime i made some more investigations and tried a similar thing with an XLS file. The Problem was, that when i ran the code in debug step mode, it would not work! I used the Press ALT command followed by send>fa and Release ALT
Running it directly did the job! Saw some remarks in the forum regarding differences in debug and direct mode! Are there any known issues?

SkunkWorks wrote:I created a test by creating a form called ClientData on a database of the same name. Then opened IE to CNN.com and ran this script. I had no problems changing focus even if the form window was maximized inside MSAccess...

Label>ResetFocus
wait>2
Setfocus>CNN*
wait>2
setfocus>ClientData*
wait>2
goto>ResetFocus

I'm sure you've checked, but did you spell the window name correctly? Is this a standard MSAccess form a user could create with the form wizard? Have you included the * at the end of the window name just in case you have a space or other unseen character in the window name?

Could you post some of your code here for us to see?

Thanks, I hope we can help.

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Sat Aug 12, 2006 5:13 pm

I'm glad the issue is resolved...running in debug mode would have been a good thing to include in the original post. Any time you have an app that you are debugging, it is not always easy to check it out in Debug mode. My suggestion is to wrap all your vars in % (%var%) and turn on logging, which will make you logfile display the actual values instead of the var names. Also place plenty of MessageModal lines in your script (for testing) so you can have the program "echo back to you" the settings of certain vars or the result of certain operations (waitwindowopen, writeln, etc...)

Keep scripting...

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts