Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Thanked 0 Times in 0 Posts

    Report/ form (2000)

    I currently have a form which contains two subforms. Both subforms are linked to the main form. I am trying to create a report (that will have a print button on the main form for this report) that will print a report based off of the current record on the main form. I also want to be able to have the report show the subforms and all of the records on the subform that is linked to the current record of the main form.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Report/ form (2000)

    Create a report with two subreports, similar to the form and subforms. A very easy way to do this is to select the form in the database window, then select File | Save As... and save it as a report. Let's say you name it rptReport. It won't look great, though.

    Next, put a command button cmdReport on the form and create an On Click event procedure for the command button. You will need a field identifying the current record, let's say it is a number field named ID.

    Private Sub cmdReport_Click()
    DoCmd.Open "rptReport", acViewPreview, , "ID = " & Me.ID
    End Sub

    If the ID field is a text field, use

    ..., "ID = " & Chr(34) & Me.ID & Chr(34)

    Chr(34) is the double quote character ".

Posting Permissions

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