"croy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In a text control on a form, I'd like to be able to type
> some text, and then be able to hit a hotkey (before leaving
> or saving the field), and have the hotkey append some
> "canned" text in front of the text already typed. The
> canned text is something that would be occasionally added,
> and when it is added, would always be the same.
>
> I've tried using OldValue, but it doesn't seem like the text
> entered manually has become OldValue until the focus leaves
> the control--true?
>
> I could tell the users to hit the hotkey first, then add
> their additional text, but that's not quite as forgiving for
> the user.
>
> Any ideas appreciated.
>
> --
> croy
You might try something like this in the KeyDown event (of TextBox1 for
example)to intercept a hotkey (Ctl-h, in this case) and insert the text.
Private Sub txtTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = Asc("H") And (Shift And acCtrlMask) > 0 Then
KeyCode = 0
txtTextBox1.Text = "Prefix-" & txtTextBox1.Text
End If
End Sub
--
Mike
-----------------------------------------------------------------------
Michael J. Strickland
Quality Services
(E-Mail Removed)
703-560-7380
-----------------------------------------------------------------------
---
news://freenews.netfront.net/ - complaints:
(E-Mail Removed) ---