Results 1 to 5 of 5
  1. #1
    Detectiveclem is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2018
    Posts
    8

    Question Printing only the current record

    I would like to be able to print and email a single report showing only the detail of the current record I am viewing. At present I am able to set up the command button for printing or emailing, but the report relates to all my records rather than the record I am currently viewing.


    I have looked at previous answers provided on this forum and viewed my code and only see the following.

    Private Sub Command567_Click()



    End Sub

    I would be grateful if someone could assist me resolving my issue.

    Thank you

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Tell us about your report and the record/table involved.
    The DoCmd.OpenReport has parameters to identify the data to be used in the report.

    See this article from TechOnTheNet on Opening a report ( to all records, or selected record)

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,523
    The report query would use the current ID on the form,

    select * from table where [id]=forms!myform!ID

  4. #4
    Detectiveclem is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2018
    Posts
    8
    Hi again ranman256,

    I am not sure what you are suggesting here? Do I need to add select * from table where [id]=forms!myform!ID to my code?


    Sorry for being slow on the update, but I am still feeling my way with Access.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    Options:

    1. Dynamic parameterized query as the report Recordsource - ranman is suggesting this but I never use them - then open report manually or with OpenReport command in code (macro or VBA)

    2. Code (macro or VBA) that executes OpenReport command using its WHERE ARGUMENT to pass filter criteria - orange provided link to example
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Printing current record
    By koncreat in forum Forms
    Replies: 3
    Last Post: 06-18-2018, 12:54 PM
  2. Replies: 19
    Last Post: 01-06-2018, 08:56 PM
  3. Replies: 7
    Last Post: 02-18-2015, 12:07 PM
  4. Replies: 4
    Last Post: 02-17-2015, 06:49 AM
  5. Replies: 3
    Last Post: 02-06-2015, 01:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums