Results 1 to 4 of 4
  1. #1
    LoriWhit is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2010
    Location
    Texas
    Posts
    2

    Macro for Parameter Value from Form automatically into report?

    In a form – attached to a button I have written an embedded macro to OpenReport/RunCommand [Print]/Close Report -- 7 times. I am printing 7 different reports but all have the same criteria (primary key – which is how they are looked up in their querry - which is their record source). I would like to further automate the process by not having to type in the Parameter Value between each page printing – is there a way for the Parameter Value in the form I am in to be automatically entered into the Parameter Value for the Reports I am printing – so that my production manager doesn't have to sit at her computer and type it in each time??-{ she likes to take breaks - go figure}??
    And to take it even a step farther is it possible when printing to pdf printer – that the file name be automatically entered as the report name? Okay – the aforementioned would really just be icing – My production manager could live without that one – but it would be a sweet bonus for her.


    I am not an Access 2007 Guru and am sorry but do not understand code. So it would help if the format of answer included exactly where to put the statement, Action, argument or condition within the property sheet (events).
    Example:
    TO OPEN A REPORT
    Action: OpenReport
    Argument: [Select Report Name you wish to open]
    NEXT TO PRINT
    Action: RunCommand
    Argument: Select Print
    NEXT TO CLOSE
    Action: Close
    Argument: [Select Report Name you wish to close]
    Any help would be much appreciated…. Thank you Thank you Thank you Thank you...
    Lori

  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,521
    Personally I would use this technique:

    BaldyWeb wherecondition

    which uses VBA code. If you're unfamiliar with that, here's a start:

    http://www.baldyweb.com/FirstVBA.htm

    The OpenReport macro action has a similar argument, if you want to stick with macros.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    LoriWhit is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2010
    Location
    Texas
    Posts
    2
    Thanks Paul -- I think that will all help.. But, I still don't know where to right it.????

    I have 7 strings of

    Open Report
    Print Report
    Close Report

    in the Macro -- where do I write the code??? so that it will select the proper record for each report???

    These may be silly questions - but I do not understand how to program - but, have been able to write a pretty functional database that we have been using for the past year and it's works well - but now I want to make it sing.... this will help...

    THanks,
    Lori

  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,521
    As I said, I would use VBA code rather than the macro. In any case, even in the macro you only need one line per report. The OpenReport action has an argument that determines whether the report opens for viewing or is sent to the printer (the View argument). The Where Condition argument is where you'd give it the parameter. I don't use macros, so you'll have to look in help at the macro action for the syntax. On my site I gave you the syntax for VBA code.
    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. Automatically email report
    By Lockrin in forum Access
    Replies: 6
    Last Post: 01-18-2010, 12:35 PM
  2. Automatically choose which report?
    By Lockrin in forum Reports
    Replies: 2
    Last Post: 12-28-2009, 02:41 PM
  3. Report with Parameter Query/Form
    By maggioant in forum Reports
    Replies: 0
    Last Post: 10-09-2009, 09:48 AM
  4. Replies: 1
    Last Post: 05-01-2009, 07:33 AM
  5. Using parameter in autoexec macro
    By lchurch in forum Queries
    Replies: 0
    Last Post: 03-04-2009, 06:22 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