How to print screen in Access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • achaudhri
    New Member
    • Nov 2006
    • 3

    How to print screen in Access

    I have a form which has one to many kind of display actually it is Appointments page for an employee and an emploee may have a number of appointments in the past which all are listed here in the form.

    When I try to print this form thru a Macro ( PrintOut) it prints an many times as the number of appointments.

    So how to make it print it just once. i mean actually it should do Kind of PrintScreen type.

    Any Help will be appreciated,
    Thanks,
    Archana
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by achaudhri
    I have a form which has one to many kind of display actually it is Appointments page for an employee and an emploee may have a number of appointments in the past which all are listed here in the form.

    When I try to print this form thru a Macro ( PrintOut) it prints an many times as the number of appointments.

    So how to make it print it just once. i mean actually it should do Kind of PrintScreen type.

    Any Help will be appreciated,
    Thanks,
    Archana
    PrintOut can be a little quirky, so here is a little trick, that will always Print 'only' the Current Record on a Form:
    1. Filter on the Primary Key Field on your Form.
    2. Set FilterOn = True.
    3. Print the single Form Record.
    4. Remove the Filter (FilterOn = False).
    5. You can even return to the Record that you Printed if you so desired.


    [CODE=vb]Me.Filter = "[Product ID]=" & Me![txtProductID]
    Me.FilterOn = True

    DoCmd.SelectObj ect acForm, Screen.ActiveFo rm.Name, False
    DoCmd.PrintOut

    Me.FilterOn = False[/CODE]

    Comment

    • achaudhri
      New Member
      • Nov 2006
      • 3

      #3
      Thanks for your reply,

      but there are 2 tables employee & appointments for every employee there can be many appointments ( say "n") . So when i print the appointments screen it prints it correctly but prints it a number of times ( "n" times).

      This is because setting is to print current selection and all those appointment records are selected at this point of time.

      Is there a way to not print current selection of records but to just "print the screen".

      Thats whay i think P. Key funda wont apply here as all those appointment belong to that particular employee.

      Thanks,
      Archana

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by achaudhri
        Thanks for your reply,

        but there are 2 tables employee & appointments for every employee there can be many appointments ( say "n") . So when i print the appointments screen it prints it correctly but prints it a number of times ( "n" times).

        This is because setting is to print current selection and all those appointment records are selected at this point of time.

        Is there a way to not print current selection of records but to just "print the screen".

        Thats whay i think P. Key funda wont apply here as all those appointment belong to that particular employee.

        Thanks,
        Archana
        The following code will copy the Active Screen to the Clipboard. You can then Paste it into any Application that will support this type of operation. Don't think this really helps - but it is an idea.
        [CODE=vb]SendKeys "%({PRTSC}) ", True[/CODE]

        Comment

        • jamjar
          New Member
          • Apr 2007
          • 50

          #5
          Originally posted by achaudhri
          Thanks for your reply,

          but there are 2 tables employee & appointments for every employee there can be many appointments ( say "n") .
          ......
          Thats whay i think P. Key funda wont apply here as all those appointment belong to that particular employee.

          Thanks,
          Archana
          I think you could add the second part of the key (Appointment) to the filter. If you use the code ADezii suggested it would become:
          Code:
          Me.Filter = "[PersonID]=" & Me![txtProductID] & "[AppointmentID]=" & Me![txtApptID]
          Me.FilterOn = True   
          DoCmd.SelectObject acForm, Screen.ActiveForm.Name, False
          DoCmd.PrintOut
          Me.FilterOn = False
          or you could use filter by form to narrow the records returned to just the one before you print.

          James

          Comment

          Working...