Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manually copying text from a text box

Status
Not open for further replies.

bigdars

MIS
Dec 13, 2001
29
0
0
US
I have a database that I have inherited, so I am not very familiar with it. Someone has shown me something that I do not have a solution to. One of the fields in a form contains data from a memo field. When you try to highlight the text with your mouse, it will only let you select about the first 260 characters worth of data to copy. Since this database is informational, there are occasions that staff pull up information and then want to copy it to their own files/documents. If you try to start your selection from the center of the text box, it still stops in the same location. Any suggestions are appreciated.
 
Hi,

You can try this method:

1. Create a command button on your form (but don't run the wizard)
2. On this command button's "On Click" event paste this code in:

TextBoxName.SetFocus
DoCmd.RunCommand acCmdCopy

- This copies the values from the text box to the clip board. The user can then paste into other documents using either a paste button in the other program or the "Ctrl + V" key combination,

Hope this helps,

jbehrne If at first you don't succeed, call in an airstrike. - Murphy's Laws of Combat Operations
 
Forgot to tell you that you need to change "TextBoxName" to the name of the textbox on your form that holds the information that you are copying from.

jbehrne If at first you don't succeed, call in an airstrike. - Murphy's Laws of Combat Operations
 
Thanks for the reply. I will try it out tomorrow morning.
 
Hi bigdars,

Sure thing let me know if it works!

I am going to paste a modified bit of code here that tells the user that the text was copied:
- This code is run on a button called "copy". It runs on the button's "On Click" event.


Private Sub copy_Click()
On Error GoTo Err_copy_Click

TextBoxName.SetFocus
DoCmd.RunCommand acCmdCopy
MsgBox "Text has been copied. You can now paste it into your document.", vbOKOnly, "Text copied"

Exit_copy_Click:
Exit Sub


Err_copy_Click:
MsgBox Err.Description
Resume Exit_copy_Click

End Sub

HTH,

jbehrne
If at first you don't succeed, call in an airstrike. - Murphy's Laws of Combat Operations
 
The code works up to the same point...but it stops at the same spot. When I paste the text after clicking the button, it only pastes the limited characters and not the entire field. I recounted the text and it stops at the 255 character mark. Obviously it is interesting because it is the size of a byte, but I can't figure out why it stops when the characters are being displayed. I can't select any text following the 255th character.
 
Hi,

What is the data type for the field in question?

jbehrne If at first you don't succeed, call in an airstrike. - Murphy's Laws of Combat Operations
 
The field comes from a query which pulls the data from two different tables. The table columns pulled are both Memo fields. Is there something in the query that would cause this maybe?
 
Hi,

I understand you correctly the Memo field on your form is actually the combination of two memo fields. Futhermore it would appear that you are just grabbing the info from one of the tables and not the other. I would say that your best bet would be to get rid of one of the memo fields and just stick with one. It doesn't make sense to have two memo fields to hold data that one could easily handle. Howver, if you don't want to do this and you just want to grab the values from the query than you will need to create a query (or use the DLookup statement) to grab the two fields from the tables. Then set a variable equal to the two fields:

Dim TwoFields, Info1, Info2

Info1 = DLookup("[MemoField]", "Tbl1", "[RecID] = [Me!RecID]")
Info2 = DLookup("[MemoField]", "Tbl2", "[RecID] = [Me!RecID]")

TwoFields = Info1 " & " Info2

Me!TextBoxName = TwoFields
Me!TextBoxName.SetFocus
DoCmd.RunCommand acCmdCopy
MsgBox "Text has been copied. You can now paste it into your document.", vbOKOnly, "Text copied"


Of course if I have this wrong then let me know...

jbehrne If at first you don't succeed, call in an airstrike. - Murphy's Laws of Combat Operations
 
The memo fields are actually from two different databases. I only display one of the fields via the query/linked tables. One database contains active cases and the other contains closed. If the case is closed, it pulls from one table and visa versa...never from both tables at the same time. Sorry if I was vague on the description. The final data displayed always just comes from one table and all the data appears...I just can't select more than the first 255 characters to copy! Thanks for your assistance on this.
 
Hi,

Here are two things you can try:
1. Create another table with only one field (call it MemoTest) whose data type is "Memo". Create a form that interfaces with this table. On the form create a button whose "On Click" code is this:

Me!MemoTest.SetFocus
DoCmd.RunCommand acCmdCopy

Type some arbitrary data into the table that exceeds 255 characters in length. See Access will let you copy all the data from that field. If you can then we are starting to narrow your problem down.

2. I have done some research and the problem may be with the version of Microsoft Jet engine that you are using. Try this link, update the Jet engine and see if you still get the problem.


You should, of course, read microsoft's details... HOwever, from what I have found at Microsoft's support site they claim that this will fix the problem.


HTH,

jbehrne If at first you don't succeed, call in an airstrike. - Murphy's Laws of Combat Operations
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top