[AccessD] A2000: Inserting HTML codes into a Text Box

Steve Erbach erbachs at gmail.com
Thu Apr 14 13:51:43 CDT 2005


Liz,

You know, when I was puzzling over this before I posted my question, I
tried to find the commands for selecting text in a text box, but was
unsuccessful. SelStart! That's it.

I was trying to duplicate what I could do manually if I were, say, to
record a keystroke macro...as if Access allowed me to do something
like that. I'd select the text, press Ctrl-X to cut, type in <b>,
press Ctrl-V to paste the text back in, and finally type </b>. I
couldn't for the life of me figure out why I couldn't do this even
though there are RunCommands for acCmdCut and acCmdPaste. When I tried
to do this in code I go a message saying that Paste was not
appropriate in the current context or something like that.

Hmmm...this is worth looking into. Thank you very much.

Steve Erbach

On 4/14/05, Liz Doering <ldoering at symphonyinfo.com> wrote:
> Steve,
> 
> I just create buttons along side of my text box for this, with names like
> "Paragraph" or "Bold".  Use the & to give the alt+p or alt+b keyboard
> functionality.  This way, the user can just add the symbol they want as they
> are typing.
> 
> Then on the button click do this:
> 
> Me.txtMyHTMLTextBox = Me.txtMyHTMLTextBox & " add this"
> Me.txtMyHTMLTextBox.SetFocus
> Me.txtMyHTMLTextBox.SelStart = Len(Me.txtMyHTMLTextBox) + 1
> 
> You have to set the focus back on the end of your text, otherwise it will
> stay on the button.
> 
> You could also set a hidden field for off and on, so that the first time she
> hit the button it would produce <b> and the second time it would produce
> </b>.
> 
> 
> Liz



More information about the AccessD mailing list