Results 1 to 4 of 4
  1. #1
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86

    Preview a Report from What is on the Screen

    Here is my code for a print button that was working and now it is not. Any explanation why this may have quit working?
    Is there a way to use a macro for this instead of the code. I am using the exact code with the exception of the button name and report name for other forms and it is working fine. This previews a report based on the records that is on the screen.

    DoCmd.RunCommand acCmdSaveRecord
    DoCmd.OpenReport "rpt_EQUIP_SALES_REPAIR_REQ", acViewPreview, , "[ProjectID] = '" & [ProjectID] & "'"

    Thanks!

  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,652
    That looks fine, presuming the ProjectID field is text. You can use a macro; you'd want the wherecondition argument, but look in help as the syntax is different.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86
    Thanks for the help. I figured it out. The problem was with the query running the report and there nothing in the connecting table of the query so it was bringing back a blank report, so it was not the print button code after all.

  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,652
    No problem; 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. Report Preview
    By roaftech in forum Reports
    Replies: 3
    Last Post: 11-15-2012, 01:59 PM
  2. Replies: 11
    Last Post: 06-05-2011, 09:51 PM
  3. Report Preview
    By ColPat in forum Programming
    Replies: 2
    Last Post: 06-25-2010, 02:44 PM
  4. Can't see sub report in print preview
    By LoggyDoggy in forum Access
    Replies: 1
    Last Post: 04-20-2010, 05:38 PM
  5. Report preview from sub form
    By Hillary in forum Forms
    Replies: 2
    Last Post: 01-31-2010, 07:50 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