Memo Field - select text

Bechert

Registered User.
Local time
Today, 15:00
Joined
Apr 11, 2003
Messages
59
Hello,
I have functioning code in a command button that will capture ALL the text in a memo field and save it to a special keyed table based on the name of the memo field.

I would like to add a new feature where the user can select / hi-light some of the text in the memo field and the command button will process the selected text just as it does for ALL the text.

This process is similar to the copy / paste function. However, I don't want the user to have to learn / remember to do any more than to select the text and click the command button.

What is the code I need to add to the command button to capture the selected / hi-lighted text?

Thanks,
Bill
 
Bob, the code to capture the content of the memo field is


StText = Forms(GlobalSavedTextFormNam)(GlobalSavedTextFieldNameInternal)

Thanks,
Bill
 
Have a module-level string variable declared (e.g., Private strSelectedMemoText as String at the top of your Form's code module).

In the LostFocus event (aka OnLostFocus in the Properties page of the control) of your memo field's textbox, put in this code:

strSelectedMemoText = MemoField.SelText

Then in the Click event of your command button, you can use this variable to know what text (if any) was selected. Make sure to test it to see what does happen if nothing is selected, and you'll want to set this variable to = "" whenever the record changes to avoid accidentally carrying over old data to a different record.
 

Users who are viewing this thread

Back
Top Bottom