Printing Current Page on Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jawbone
    New Member
    • Nov 2011
    • 14

    Printing Current Page on Form

    Hell all, i really need some help.
    I dont know how to use code at all, just started working with access07 for a month. Ive created a table name it freedom, i also created a Query from it named it freedom Query. and a report named new freedom. Here's the problem i have multiple clients on the form, but when i try to print the client info im currently viewing on my form on a report it prints all of the clients at once. i tried using a open report macro-view report and my where is set as passengerID which is my primary id for the freedom table. can you please tell me what im doing wrong. im very new at this.
    Thanks alot.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    If you are asking how to Print the Current Record on a Form:
    Code:
    With DoCmd
      .RunCommand acCmdSelectRecord
      .PrintOut acSelection
    End With

    Comment

    • jawbone
      New Member
      • Nov 2011
      • 14

      #3
      thanks Adezii
      that is what i want. so where do i include my form name and so on

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        You do not need to include the Form Name, simply navigate to the appropriate Record then execute this Code. I would imagine that the best location for the Code would be in the Click() Event of a Command Button on your Form with a Caption similar to Print Current Record.

        Comment

        • jawbone
          New Member
          • Nov 2011
          • 14

          #5
          That worked out perfect for my form, but maybe im not explaining the problem im having right. i want to add a button on my form that can access a report and print that report in a single form. filter that report so that it would only print the current record selected.

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            You would use the Where Argument of the OpenReport() Method. assuming that I have an Employees Form, and that I wish to Print an Employees Report (rptEmployees) for the Current Record. As long as the [EmployeeID] Field exists on the Form, and as part of the RecordSource for the Report:
            Code:
            DoCmd.OpenReport "rptEmployees", acViewNormal, , "[EmployeeID] = " & Me![EmployeeID]

            Comment

            • jawbone
              New Member
              • Nov 2011
              • 14

              #7
              thanks Adezii it worked great

              Comment

              • ADezii
                Recognized Expert Expert
                • Apr 2006
                • 8834

                #8
                @jawbone:
                Glad it all worked out for you.

                Comment

                Working...