Replacing SendKeys

G

Guest

I have 'timing' problems with a database converted from Access97 to 2003.
Features which have worked happily (in 97) now give variable performance,
sometimes with errors. I have tracked the problem to [probably] using
SendKeys. I have read several posts which warn about the use of SendKeys and
am trying to remove them. One issue is a feature I have used in many 'List'
Forms with a sub-form with a list from which a selection can be made. A
Command button [Proc] on the main form will move to a different Form. I have
used the following code in the Form_DblClick Code on the subform to achieve a
move with a single (doubleclick) action on the Form, rather than select with
mouse and 'enter':
Me.Parent![Proc].SetFocus
SendKeys "{Enter}", True
This was done because the Code behind Proc_Click can be quite complex and
this seemed to be the obvious way to run the main form 'Proc' code from the
action of double-clicking in the sub-form [and it worked happily in 97!!].
Is there a better way to run this code to avoid the SendKeys?
Thanks for any suggestions
John Ross
 
D

Dirk Goldgar

John Ross said:
I have 'timing' problems with a database converted from Access97 to
2003. Features which have worked happily (in 97) now give variable
performance, sometimes with errors. I have tracked the problem to
[probably] using SendKeys. I have read several posts which warn about
the use of SendKeys and am trying to remove them. One issue is a
feature I have used in many 'List' Forms with a sub-form with a list
from which a selection can be made. A Command button [Proc] on the
main form will move to a different Form. I have used the following
code in the Form_DblClick Code on the subform to achieve a move with
a single (doubleclick) action on the Form, rather than select with
mouse and 'enter':
Me.Parent![Proc].SetFocus
SendKeys "{Enter}", True
This was done because the Code behind Proc_Click can be quite complex
and this seemed to be the obvious way to run the main form 'Proc'
code from the action of double-clicking in the sub-form [and it
worked happily in 97!!]. Is there a better way to run this code to
avoid the SendKeys?
Thanks for any suggestions
John Ross

You could change the parent form's Proc_Click from a Private Sub to a
Public Sub, and then explicitly call it from the subform:

Me.Parent.Proc_Click
 

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

Similar Threads


Top