Welcome to Dream.In.Code
Getting Help is Easy!

Join 131,626 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,162 people online right now. Registration is fast and FREE... Join Now!




Access: copying text from a form to a report

 
Reply to this topicStart new topic

Access: copying text from a form to a report

SeanD_RI
post 13 Oct, 2008 - 04:15 AM
Post #1


New D.I.C Head

*
Joined: 30 Sep, 2008
Posts: 14


My Contributions


I've got a text box set up in an Access form that I'm using as a log, and I want to be able to transfer the text in this log to a report so said text can be output to a nice .rtf file. Is there some easy way to transfer the text from the text box on the form to a text box on the report?
User is offlineProfile CardPM

Go to the top of the page


PsychoCoder
post 13 Oct, 2008 - 05:05 AM
Post #2


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,906



Thanked 116 times

Dream Kudos: 8450

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
User is offlineProfile CardPM

Go to the top of the page

SeanD_RI
post 13 Oct, 2008 - 05:39 AM
Post #3


New D.I.C Head

*
Joined: 30 Sep, 2008
Posts: 14


My Contributions


But I don't know what the code I need is, that's the problem. I've got this
CODE

Private Sub Report_Activate()
    Dim strBody As String
    
    ' Get the text from the report
    strBody = Forms!frmMain!txtLog
    ' MsgBox strBody
    
    ' Now that we have text, put it in the form
    ReportBody.Text = strBody
    
End Sub

but it doesn't seem to work. Hense me asking if anyone knew how to do it.
User is offlineProfile CardPM

Go to the top of the page

dlkirk03
post 13 Oct, 2008 - 05:33 PM
Post #4


New D.I.C Head

*
Joined: 12 Sep, 2008
Posts: 23


My Contributions


Set the text in the text box to a string variable and then use a label on the report and set the label.text = to the variable. Or leave the form open and set a text box on the report = to the form textbox. Let me know if those ideas don’t work and I will work on it.
User is offlineProfile CardPM

Go to the top of the page

SeanD_RI
post 14 Oct, 2008 - 04:11 AM
Post #5


New D.I.C Head

*
Joined: 30 Sep, 2008
Posts: 14


My Contributions


QUOTE(dlkirk03 @ 13 Oct, 2008 - 06:33 PM) *

Set the text in the text box to a string variable and then use a label on the report and set the label.text = to the variable. Or leave the form open and set a text box on the report = to the form textbox. Let me know if those ideas don’t work and I will work on it.


Thanks, but I actually figured out that the easiest way to do it isn't to set stuff in code, but to go into the text box's Properties, and set the Control Source to "=Forms!<form name>!<control name>". That way the report gets the text every time it's loaded, and you don't have to monkey around with globals or anything.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 05:16AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month