SendKeys between two forms

S

Steven

I have a form that when you dbl click a textbox it opens
another form on top. Is there a way to, for example, use
SendKeys "A" from the form that was opened on top to the
textbox that was dbl clicked in the first form?

Thank you for your help.

Steven
 
R

Rick B

I don't know about using 'sendkeys' but in your double click code on formA
why not just set the field value to "A"?

Not sure what you are trying to accomplish.

Give us more details. what are the forms and fields for?

Rick B


I have a form that when you dbl click a textbox it opens
another form on top. Is there a way to, for example, use
SendKeys "A" from the form that was opened on top to the
textbox that was dbl clicked in the first form?

Thank you for your help.

Steven
 
D

Dirk Goldgar

Steven said:
I have a form that when you dbl click a textbox it opens
another form on top. Is there a way to, for example, use
SendKeys "A" from the form that was opened on top to the
textbox that was dbl clicked in the first form?

Thank you for your help.

Steven

It would probably be possible, but it would most likely be a bad idea.
SendKeys is buggy and inherently unreliable. Assuming you can get at
the design view of both forms, you can almost certainly do whatever it
is you ultimately want to accomplish by directly manipulating the forms,
their objects, and their code. For example, it's trivial to assign a
value to a particular text box on a form. If you'd care to describe
what you are really trying to achieve, I'll bet someone here can suggest
a good way to do it that doesn't involve SendKeys.
 
S

Steven

I have a challenge with someone where I told them I could
type their name in a textbox with only my mouse. I was
planning on double clicking in the box and have a
typewriter looking form open(ie the letters will be
arranged like a typewriter). Each letter will be a Label
and use the OnClick property to send the letters to the
textbox on the other form.

Thanks for your help.
 
S

Stephen Lebans

A couple of ideas:

1)
Use a hidden Label control that you active when clicking on the TextBox.
Send the output from the Label control to Screen.PreviousControl always
doing something like:
Screen.PreviousControl.Value = TheLetterJustClicked &
Screen.PreviousControl.Value
There is sample code here:
http://www.lebans.com/selectalpha.htm


2)
Only use the current TextBox control. When the TextBox receives the
focus save off it's current contents in case the user changes their
mind. Next place the string, A through to Z and the word "Done" and into
the TextBox. Now add a hard cr using vbCRLF. Using the same code from
the sample project in #1, modify the MouseDown event so that you add the
selected characters to the very end of the TextBox's contents. WHen the
user clicks on "DONE" strip out the TextBox's contents up to and
including the vbCRLF.


--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
V

Van T. Dinh

Hi Stephen

I was thinking of "SelectAlpha" also.

Assuming the characters should be inserted from left to
right, then I think the statement should be:

Screen.PreviousControl.Value =
Screen.PreviousControl.Value & TheLetterJustClicked

Cheers
Van
 

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