If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Linking Text Boxes?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-23-11, 09:59
Jammwood Jammwood is offline
Registered User
 
Join Date: Nov 2011
Posts: 2
Exclamation Linking Text Boxes?

Hello,

I have currently got a link set between a Form and a Report so that what you can see in the Form is printed in the layout of the Report. This is done using a command button which I have coded myself. When the button is pressed a print preview comes up for that record and this is then printed to give a single print out for one record not the entire database.

I would now like to be able to type information, I.E. what I have sold to the customer, into a text box and for this to appear on the report when printing.

Can anyone suggest a way to do this? Maybe by linking the text boxes on the form to the report somehow?

This is fairly urgent so quick replies would be very much appreciated.

Thanks,

James
Reply With Quote
  #2 (permalink)  
Old 11-23-11, 12:18
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 3,446
You can pass one or several values to the report when you open it.

In the Form module:
Code:
Private Sub Command_OpenReport_Click()

    DoCmd.OpenReport "ReportName", acViewPreview, , , , Me.Text_ToReport.Value
    
End Sub
Where:
Text_ToReport is the name of the textbox that contains the value you want to send to the report.
ReportName is the name of the report that, when open, receives the transmitted value.

In the Report module:
Code:
Private Sub Report_Open(Cancel As Integer)

    Me.Label_FromForm.Caption = Nz(Me.OpenArgs, "")
    
End Sub
Where:
Label_FromForm is the name of a label that will display the data received from the form.
__________________
Have a nice day!
Reply With Quote
Reply

Tags
access, form, linking, text boxes

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On