none
MS Access form browsing a table and requesting a report

    Question

  • I have a form that browses a table in table view.

    I also have a report with a parameter selection that I want to populate the parameter with the Item number from that specific row of data and produce a report based on that item number.

    How can I populate that parameter request from the report with the item number from that current row.

    I have a macro that calls the form when I clik on it, but do not have an example of how to get the item number into the parameter for the report.

    Could not find any exampes of producing a report based on the item selection.

    Thank you

     

    Tuesday, October 08, 2013 2:08 PM

Answers

  • It's still a one-liner, using the WhereCondition argument. Something like:

    DoCmd.OpenReport "myReport", acViewPreview, , "ItemID=" & Me.ItemID


    -Tom. Microsoft Access MVP

    Tuesday, October 08, 2013 2:23 PM
  • Good Afternoon Bryant,

    One line of code is what Tom is referring to

    DoCmd.OpenReport "myReport", acViewPreview, , "ItemID=" & Me.ItemID

    You can put the line of code wherever it works for you. You can have a command button in the Header Section of the Form and using the On Click Event, add this code. Then save the Form and Run it. When you click on a Record to select it, then click the command button to print it should print the current Record.

    Hth


    Chris Ward

    Tuesday, October 08, 2013 8:25 PM

All replies

  • It's still a one-liner, using the WhereCondition argument. Something like:

    DoCmd.OpenReport "myReport", acViewPreview, , "ItemID=" & Me.ItemID


    -Tom. Microsoft Access MVP

    Tuesday, October 08, 2013 2:23 PM
  • I have a form that browses a table in table view.

    I also have a report with a parameter selection that I want to populate the parameter with the Item number from that specific row of data and produce a report based on that item number.

    How can I populate that parameter request from the report with the item number from that current row.

    I have a macro that calls the form when I clik on it, but do not have an example of how to get the item number into the parameter for the report.

    Could not find any exampes of producing a report based on the item selection.

    Thank you


    Tom Thanks for the info, but I'm not that familure with one-liners. Where would this go in the form? and how do I link the query for the report to the item_ID from the form?
    Tuesday, October 08, 2013 5:27 PM

  • Tom Thanks for the info, but I'm not that familure with one-liners. Where would this go in the form? and how do I link the query for the report to the item_ID from the form?
    Tuesday, October 08, 2013 7:51 PM
  • Good Afternoon Bryant,

    One line of code is what Tom is referring to

    DoCmd.OpenReport "myReport", acViewPreview, , "ItemID=" & Me.ItemID

    You can put the line of code wherever it works for you. You can have a command button in the Header Section of the Form and using the On Click Event, add this code. Then save the Form and Run it. When you click on a Record to select it, then click the command button to print it should print the current Record.

    Hth


    Chris Ward

    Tuesday, October 08, 2013 8:25 PM