SendKeys between two forms

  • Thread starter Thread starter Steven
  • Start date Start date
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
 
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
 
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.
 
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.
 
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.
 
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
 
Hi Stephen

Jumping in here in a most rude & inappropriate way ... :-)

Do you know if there is any way to attach a custom popup menu to the
right-click action of a query datasheet that is generated at runtime?

I generate new stored queries at runtime as part of an end-user adhoc
reporting tool. I display the selected query datasheet using openquery. This
is in an MDE with the option turned OFF which allows the standard
right-click menus. I want to attach a previously created custom popup menu
to the right-click action of the displayed query datasheet.

I can reference the open datasheet using ActiveDataSheet (or whatever it
is). I can even set it's OnClick property to "=Msgbox(999)", and see that
message appear when I click the top-left corner of the datasheet! But I
can't for the life of me see how to attach my custom popup menu, at runtime,
to the right-click action of the active datasheet.

Any ideas? (Again, apologies for jumping in here ...)

TIA,
TC
 
Sorry, I literally have no idea how to resolve this issue or even if it
can be resolved.
:-(

--

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