Results 1 to 7 of 7
  1. #1
    manwe_sulimo is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    9

    choose which report to run based on the record

    halo all,


    background - i have a form that show record from a table based on the user choice, and the form also return for each record (based on another table connect to the first table) which report are allowed for this record.
    i need the user to choose which report to print from a list, and the programm to print the right report with the data from the right record that open on the form.

    so far, i have managed to print the right record on the report based on the active record, but i failed to made the right report run based on active record on subform.

    thx

    so far i made this:
    Code:
    Private Sub OpenMRep_Click()
    DoCmd.RunCommand acCmdSaveRecord
    DoCmd.OpenReport "reportname", acViewPreview, , "[equipmentID] = " & equipmentID]
    End Sub

  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,640
    If the report name is in a textbox:

    DoCmd.OpenReport Me.TextboxName, acViewPreview, , "[equipmentID] = " & equipmentID]
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    manwe_sulimo is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    9
    i tried to do it with combobox, but the report names are changed based on the record and i need that the user will be able to choose just the reports that allow for this specific recored.

  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,640
    The same method will work with a combo.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    manwe_sulimo is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    9
    Quote Originally Posted by pbaldy View Post
    The same method will work with a combo.
    work like a magic.
    thank you

  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,640
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Rivanni is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    9
    Delete the last square bracket in your code.

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

Similar Threads

  1. Replies: 12
    Last Post: 07-07-2015, 08:12 PM
  2. Replies: 2
    Last Post: 10-07-2011, 08:13 PM
  3. Choose a record from a query?
    By Kevo in forum Forms
    Replies: 12
    Last Post: 07-15-2011, 09:47 PM
  4. Automatically choose which report?
    By Lockrin in forum Reports
    Replies: 2
    Last Post: 12-28-2009, 02:41 PM
  5. Replies: 3
    Last Post: 09-26-2009, 01:57 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