Results 1 to 4 of 4
  1. #1
    TOPSie is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    108

    Print a report with a single record

    I have a (fortunately) small table (43 records). I have produced a simple report using fields just in this table.
    If I do
    DoCmd OpenReport, "MyReport",acPreview,,Me.Keyfield then the report appears as a single page on my screen with all the relevant boxes pertaining to the record indexed by KeyField
    But this does not go to the printer.

    If I change the acPreview to acNormal (or just default it) then 43 pages go off to the printer!!!



    I am running out of paper - I only want a single sheet

  2. #2
    TOPSie is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    108
    I think I have answered my own question:

    It looks like the WHERE clause is parsed more exactly when in acNormal mode. It looks like the parsing is more lax in acPreview (or is it something else)

    anyway my WHERE clause for acPreview was something like - DriverId = me.DriverId and this seemed to produce jsut a single page on the screen (but were there more behind???)

    in acNormal mode I had to do the WHERE clause properly "DriverId = " & me.DriverId - then just a single page is printed!!!!

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    Opening a report in preview doesn't print it. acNormal sends it to the printer. That will likely send the print job before any filtering could be applied. What might be more pertinent is that the latter syntax is the correct way. That the other syntax worked in preview was happenstance, I'd say. IMO the main objective with this process would normally be to open the report filtered, then send it to the printer but via code steps, not acNormal. If you don't want to see the report you open it hidden.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi

    Your Command Button on the Form should have the following OnClick Event:-

    Private Sub PrintButtonName_Click()

    If Me.Dirty Then Me.Dirty = False

    DoCmd.OpenReport "ReportName", acPreview, , "[DriverID]=" & me.DriverID

    End Sub
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

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

Similar Threads

  1. Print Report for Single Record
    By Ryanm0085 in forum Reports
    Replies: 13
    Last Post: 05-03-2017, 08:33 AM
  2. Print report from a single Tab entry/record.
    By e-support in forum Reports
    Replies: 7
    Last Post: 02-15-2017, 04:30 PM
  3. Print out single record onto a report
    By CQCDave in forum Access
    Replies: 2
    Last Post: 04-23-2015, 06:54 AM
  4. Print out single record onto a report
    By CQCDave in forum Access
    Replies: 14
    Last Post: 01-08-2015, 12:55 PM
  5. How to print a single Record's report?
    By yes sir in forum Access
    Replies: 7
    Last Post: 09-20-2010, 07:31 AM

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