Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

It has been a long time since I have worked with MS Access and am not sure if I am doing this right.

I have a Report bound to a query of single list of user names. The report groups on the user name and has a sub-report in the detail that is a chart.

The sub-report/chart is based on a query that accepts a parameter of the user name. Since the sub report is not bound I need to pass the user name parameter from the main report detail onload event down to the sub-report and thus into the underlying query.

I am not understanding how to make that happen or even if my approach is sound.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I've done this many times before. It sounds like you have already created the first report. Make the second subreport retrieve all the data you want and in the format you want.

Make a macro to call up the subreport. In the macro set the where command to filter the recordset of the subreport. In the picture below, with the where command... The First =[PersonID] links to the SQL query of the subreport. The second part [Reports]![Main Report]![PersonID] will link to the main report text box titled 'PersonID'.

Access 2010 Macro

I typically put the macro in the Click event for the textbox in question. So, in this case, when the user clicks on a Person's name, the macro is run (and since the cursor is on the record I want to retrieve) the proper parameter is passed to the where condition and effectively filtering my subreport.

If you have question, please let me know.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.