dbTalk Databases Forums  

Help with the following code please.

comp.database.ms-access comp.database.ms-access


Discuss Help with the following code please. in the comp.database.ms-access forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
SRT
 
Posts: n/a

Default Help with the following code please. - 09-22-2007 , 03:27 PM






Hi,

I have the following code below, which works if I do the following

Call No1
'Call No2
Exit Sub

For whatever reason it fails at Me![Passwords2].SetFocus at the end of Sub
No2 with

Run-time Error '2110' - Unable to goto control

Any Ideas?

CODE:

Call No1
Call No2
Exit Sub

Sub No1()
strTest = Shell("C:\Program Files\MyApp\myapp.exe", 1)
sSleep (100)
AppActivate strTest
SendKeys ("12345"), True
SendKeys ("{Tab}{Enter}{Tab}"), True
For intA = 1 To 20
SendKeys ("+{Down}"), True
Next intA
SendKeys ("^(c)"), True
SendKeys "(%{F4})", True
AppActivate "Microsoft Access"
Me![Password1].SetFocus
SendKeys ("^(v)"), True
SendKeys ("{Tab}")

End Sub


Sub No2()
strTest = Shell("C:\Program Files\MyApp\myapp.exe", 1)
sSleep (100)
AppActivate strTest
SendKeys ("12345"), True
SendKeys ("{Tab}{Tab}{Tab}{Tab}{Down}{Tab}{Tab}{Enter}{Tab} "), True
For intA = 1 To 20
SendKeys ("+{Down}"), True
Next intA
SendKeys ("^(c)"), True
SendKeys "(%{F4})", True
AppActivate "Microsoft Access"
Me![Passwords].SetFocus
SendKeys ("^(v)"), True
SendKeys ("{Tab}")

End Sub



Reply With Quote
  #2  
Old   
Eric IsWhoIAm
 
Posts: n/a

Default Re: Help with the following code please. - 10-07-2007 , 05:12 PM






It seems to me that you probably have the wrong name mentioned. In your
question to us, you mention that "it fails at Me![Passwords2].SetFocus", at
the end of Sub No2.

However, when I look at the code you listed, you actually have
"Me![Passwords].SetFocus. Also, in No1, your corresponding call is
"Me![Password1].SetFocus".

Something isn't right here. Did you name them Password1 and Passwords;
Password1 and Passwords2; Password1 and Password2; or some other
combination? Check out what you actually named them, and make certain that
in your code, you have the correct names. It helps greatly if you have
identical naming conventions; that helps to avoid this kind of confusion.

Hope this helps,
Eric


"SRT" <srthomson (AT) gmail (DOT) com> wrote

Quote:
Hi,

I have the following code below, which works if I do the following

Call No1
'Call No2
Exit Sub

For whatever reason it fails at Me![Passwords2].SetFocus at the end of Sub
No2 with

Run-time Error '2110' - Unable to goto control

Any Ideas?

CODE:

Call No1
Call No2
Exit Sub

Sub No1()
strTest = Shell("C:\Program Files\MyApp\myapp.exe", 1)
sSleep (100)
AppActivate strTest
SendKeys ("12345"), True
SendKeys ("{Tab}{Enter}{Tab}"), True
For intA = 1 To 20
SendKeys ("+{Down}"), True
Next intA
SendKeys ("^(c)"), True
SendKeys "(%{F4})", True
AppActivate "Microsoft Access"
Me![Password1].SetFocus
SendKeys ("^(v)"), True
SendKeys ("{Tab}")

End Sub


Sub No2()
strTest = Shell("C:\Program Files\MyApp\myapp.exe", 1)
sSleep (100)
AppActivate strTest
SendKeys ("12345"), True
SendKeys ("{Tab}{Tab}{Tab}{Tab}{Down}{Tab}{Tab}{Enter}{Tab} "), True
For intA = 1 To 20
SendKeys ("+{Down}"), True
Next intA
SendKeys ("^(c)"), True
SendKeys "(%{F4})", True
AppActivate "Microsoft Access"
Me![Passwords].SetFocus
SendKeys ("^(v)"), True
SendKeys ("{Tab}")

End Sub





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.