Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2011
    Posts
    2

    Exclamation Unanswered: 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

  2. #2
    Join Date
    Mar 2009
    Posts
    5,441
    Provided Answers: 14
    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!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •