Results 1 to 6 of 6
  1. #1
    gebmiller1984 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jan 2015
    Location
    Devon
    Posts
    22

    Report printing a single record

    I have an Invoice input form to create a Invoice. Another table called customers is auto populated in the Invoice table. When I click the cmdPrintReport button I have created it prints nothing. Is there anything I can do to make this work?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Not much to go on. Does the report show the correct record if opened from the database window? What is it based on (table or query)? What is the code behind the button? Has the invoice been saved prior to printing?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    gebmiller1984 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jan 2015
    Location
    Devon
    Posts
    22
    Hi its based on a table. When I select to print all records on the db window it prints details except the Populated data. Invoice has been saved. Here is the code.

    Private Sub cmdPrintRecord_Click()
    Dim strReportName As String
    Dim strCriteria As String

    strReportName = "rptPrintRecord"
    strCriteria = "[CustomerName]='" & Me![CustomerName] & "'"
    DoCmd.OpenReport strReportName, acViewPreview, , strCriteria

    End Sub

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    That code will restrict the report to the customer displayed on the form (as you probably know). If you're saying it prints other details but not the details on the form, it sounds like the data on the form hasn't been saved yet. Try adding this line before the OpenReport line:

    If Me.Dirty Then Me.Dirty = False
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    gebmiller1984 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jan 2015
    Location
    Devon
    Posts
    22
    Sorted. I changed it to a Query type REport and its done it. Thanks

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Glad you got it sorted.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 09-10-2014, 08:48 AM
  2. Replies: 1
    Last Post: 05-31-2013, 11:02 AM
  3. Printing a single record in a report
    By kelann in forum Reports
    Replies: 28
    Last Post: 10-04-2012, 10:07 AM
  4. Printing a single Report from two forms
    By cvolkers in forum Programming
    Replies: 4
    Last Post: 03-06-2011, 11:27 PM
  5. Printing a single report from form
    By OFA in forum Forms
    Replies: 9
    Last Post: 06-08-2010, 09:27 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