Results 1 to 10 of 10
  1. #1
    Chris033115 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    22

    Launching report (reprint) from datasheet unable to pass needed parameter

    I have created a report that prints a transaction input via a form. All the data has been posted to tables while the document details are still on the form. The source for the report is a query that gets its "Document ID" from the current form as its CRITERIA. This works fine. I click a button and the report prints.

    Now I've added a datasheet that lists all the "Document IDs" that have been posted within a given date range. I've added a Macro to open(reprint) the same report when any Document ID is double-clicked. This is working except that it prompts for a Parameter Value and references Forms!DocDataEntry!txtDocumentID. (Note: this is the name of the original data entry form which is no longer open)

    If I manually type the Document ID (that I just double-clicked) in the parameter box, the report prints correctly. But this shouldn't be necessary.



    I know I'm missing a WHERE clause on the Macro that opens the report but nothing I've input works. I can't even hard code a document number. Actually any Where clause provided prompts additional parameter boxes to open and they ALL require the SAME INFORMATION... the Document ID.

    Any suggestions???? I'm thinking that the Criteria on the Document ID in the query should be changed to allow a Document ID from any active source.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    If possible, would be difficult and require VBA custom function.

    I never use dynamic parameterized query. I also don't use macros, only VBA. Review: http://www.allenbrowne.com/ser-62.html
    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.

  3. #3
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    I would remove the criteria from the query and use this, which would let it be used from anywhere:

    http://www.baldyweb.com/wherecondition.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Chris033115 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    22
    Thanks! That works. It provided the report but sent it straight to the printer so I made a couple changes:

    Code:
    DoCmd.OpenReport "DocumentReporting",acViewReport , , "DocumentID = '" & Me.txtDocumentID & "'",acDialog

  5. #5
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    No problem. Personally I'd use acViewPreview, but either will work. I use the format events sometimes, and they don't fire in Report view.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Chris033115 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    22
    I started with the print preview but it defaulted to 45% or something like that and I couldn't find where I could change the setting for it to be full size. I've only been working with Access for a little over a month... and greatly appreciate the help I've gotten on THIS forum.

  7. #7
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    You should be able to add this after the OpenReport line:

    DoCmd.Runcommand acCmdZoom100

    There are other options for the percentage.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    A report should open to zoom level it was previously closed from.
    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.

  9. #9
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Not in my experience, and if a method to force it to open like you want exists, why not use it rather than rely on "should"?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Interesting, thought sure I had experienced that but having difficulty replicating right now. Oh well, as you said, code does the trick, although I haven't needed it. My reports open to full page view.

    Try setting report properties:

    DefaultView: Print Preview

    FitToPage: Yes
    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. Replies: 7
    Last Post: 03-11-2015, 12:48 PM
  2. Launching a Report from a Calendar
    By Nuke1096 in forum Access
    Replies: 1
    Last Post: 01-28-2014, 01:27 PM
  3. Replies: 1
    Last Post: 02-28-2013, 01:20 PM
  4. How To Pass a String to a Parameter in a Report
    By hammer187 in forum Programming
    Replies: 1
    Last Post: 09-17-2012, 01:44 PM
  5. Replies: 2
    Last Post: 02-10-2011, 10:44 AM

Tags for this Thread

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