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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Paste into a Memo Field 1

Status
Not open for further replies.

OzSupra

IS-IT--Management
Nov 22, 2003
18
AU
I would like to create a memo field on a form and insert some text.
Next when clicking on the field it opens a form that I enter data in [three fields]. [So far that's not a problem].

Now I want to have a button on my opened form [OK] that when I click on it, it 1) Closes the form 2)Appends the text in the memo field with field 1, field 2 and then field 3.

Can this be done?

Any help would be appreciated.
Thanks in Advance.
Adrian.
 
It can be done. You would need to get the text and put it in the memo field before you close the form though. As soon as you close the form, the data from there is no longer in memory.

Create your button. add your three text boxes on your form. put code in your click event for the button that will get the text from the first text box, then the second and the third. And finally, add code to close your form.
 
I am aware of the process. It is just the code that I need to select the text and then paste it into the underlying form.

Can you help?

Ta,
Adrian.
 
Hi!

Something like this?

[tt]Forms!frmYourStartForm!txtYourMemo=me!txt1 & me!txt2 & me!txt3
docmd.close acform "frmYourSecondForm"[/tt]

HTH Roy-Vidar
 
Thanks, Yet again Roy.

Your code works well. Only one problem. The text I write on the data entry form always over writes the original text in the memo field. Is there any way to just append it?

Thanks,
Adrian.
 
Hi!

[tt]Forms!frmYourStartForm!txtYourMemo= Forms!frmYourStartForm!txtYourMemo & me!txt1 & me!txt2 & me!txt3[/tt]

All on one line. Or you could do an IF test and ask the user whether to overwrite or append if existing data.

HTH Roy-Vidar
 
Works perfectly Roy.
If I can be a real pain......?
Is there a command for a carraige return I can insert as well.

Thanks as always,
Adrian
 
Hi again!

No pain, should actually have thought of it earlier and recommended such.

Yes, vbcr is carriage return. But it seems vbcrlf is preferred (both carriage return and linefeed). Just put them where you'd like 'em, ensure there are concatination signs on both sides... (there are more, for instance the vbtab also, you'll find more in the help files)

[tt]... & vbcrlf & me!txt1 & vbcrlf & me!txt2...[/tt]

Roy-Vidar
 
Roy,
Fantastic. Many Thanks.
Adrian.
 
Thanx for the star, and the very kind words! Happy to assist!

Roy-Vidar
 
Just thought I'd say thanks too. Found this on a search today and it helped me with a problem I was having concatenating memo fields.

I try not to let my ignorance prevent me from offering a strong opinion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top