vbams-accessparametersms-access-reports

How to pass existing Parameters from Report to Query


I have a report that takes 3 parameters. In this report I have a button that runs a query. This query needs the exact same parameters. Instead of having to ask the user for the data one more time, can I just pass the existing parameters on to the query?

For the button's onclick event, I run a macro. In this macro I can control what parameters I want to send to the query, but I can't figure out how to use the existing data.

If you want more info about the database:

This database is logging working hours for my company. The report is documenting how many hours I've been working on a specific project in a period, as well as what I've been working with (comment), so I can send it to my employer. The button in the report is for running the query that marks all the working hours entries as finished (I've sent the bills).

I hope this was clear enough; if not, please let me know. As the database is in Norwegian, I don't think posting it here will help.

Thanks for your attention!


Solution

  • I would suggest creating an unbound form into which the user would enter the various parameter values, and then reference the relevant form controls from both the report & query using the syntax:

    Forms![Your Form Name]![Your Control Name]