Focused but not focused???

G

Guest

Hello,

I am sadly stuck needing to try and get Sendkeys to work for a db I'm
working on. Anyways...

My question being. When I navigate as a user, using the mouse, on a form
and click anywhere (textbox, cmd btns,...) and then use the tab key it cycles
through the various controls. However, When I associate to a cmd btn to
setfocus on a specific btn and the follow it with sendkeys, the computer
beeps and does not cycle through the controls. Could someone explain and
demonstrate using SendKeys to cycle through the controls on a form.

Thank you,

Daniel P
 
G

Guest

By adding a pause it started working. However, is there no way to send a
Spacebar key? or a right-click of the mouse?

Daniel P
 
J

John W. Vinson

Hello,

I am sadly stuck needing to try and get Sendkeys to work for a db I'm
working on. Anyways...

My question being. When I navigate as a user, using the mouse, on a form
and click anywhere (textbox, cmd btns,...) and then use the tab key it cycles
through the various controls. However, When I associate to a cmd btn to
setfocus on a specific btn and the follow it with sendkeys, the computer
beeps and does not cycle through the controls. Could someone explain and
demonstrate using SendKeys to cycle through the controls on a form.

Thank you,

Daniel P

Sendkeys is buggy, unreliable, and discontinued in 2007; and it's NEVER
necessary. You can't predict or control which form has the focus at the time a
Sendkeys action is performed - it might not be the same one as when the code
started!

If you want to execute the Click event code of a command button... call the
Click event code from your routine. I'm not sure I understand, though, why you
want multiple events to happen, just run them from code. Do your users really
want to see multiple buttons automagically highlight and click? What real-life
task are you attempting to carry out?

John W. Vinson [MVP]
 
T

tina

i can't think of a reason to simply move focus through all the controls on a
form programmatically. if you'll explain *why* you're trying to do this,
perhaps we can help you accomplish your goal.

hth
 
G

Guest

I wouldn't be doing this if it wasn't absolutely necessary! I have read
sufficient posts regarding sendkeys to know how unstable they can be, but I
need a solution and this is, so far, the only viable one.

I've place a webbrowser in a form so a specific webpage can be displayed.
The only way I can interact with the webpage is using sendkeys to tab through
the controls, enter a value, tab and click on the submit button. The problem
I was having was that the submit button doen't get activate by the {Enter}
key, but I found a work around.

I am just surprised that their is no other way than sendkeys to interact
with a webpage.

If you know of a better way to interact with a webpage, I am all ears!!!!!!

Daniel P
 
D

Douglas J. Steele

SendKeys is not a viable approach either.

If focus should shift from the webpage to some other window, your data will
be misdirected.

SendKeys has actually been removed from Access 2007 since it's so unreliable
(not to mention unnecessary).
 
G

Guest

I know you answered me previously on this subject, but is this a dead duck or
is there some type of work around possible (even if it's not directly through
access). Is there any way to perform automation to a static webpage
triggered from access. I don't know scripting, vb, c++,... anywhere that
you'd suggest I go digging?

Thank you once again Douglas (I won't bring up the subject again, I promise!).

Daniel P
 
D

Douglas J. Steele

I haven't tested, but I would think that you should be able to put a Browser
object on your form, and then use the IE DOM (Document Object Model) to be
able to address the individual fields on that form. Unfortunately, I don't
know of an example to which I can point you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top