G
Guest
Hi,
I'm very new to VBA, but learning from books and also from kind folks here
who help me patch together code for my needs. I don't even have all my
terminology correct yet.
I have a Progress Report that if run from the Report selector form runs
several queries that brings up all the data for each project. The user can
then click through each Progress report in order of ProjectID. The Progress
report is fairly complex with 4 subreports (each with it's own query) in it,
each refering to the same ProjectID, plus other ID's unique to it's
requirements as a subreport.
However sometimes it would be nice to be able to activate this Progress
Report, not from the Report selector form, but from the Project form itself,
with a command button, based on the ProjectID that is showing in that Project
form. That way the user wouldn't need to click through 20 or so project
reports to get to the one he needs.
I'm sure I could do this by doubling up on my queries, which would be
identical except for how the IDs are passed to them. In the first report, all
the ProjectIDs appear. In the second one, I'd like for just one set of IDs to
be passed. I'd like to use the same set of queries to serve both roles
instead of doubling up on them.
So it seems like somehow I need an If Then statement in my query that could
determine (this is my guess) from which form the command was executed
(me.form ?). If it was from the Report selector page, then run it for all the
ProjectIDs (as it presently does), or if it was from the Project form, then
run it just for the specific ProjectID on that form.
Could that code be written into the parameter or criteria for the query?
If so, any suggestions on what the code would be?
Thanks very much for taking the time to look at this.
Harold
I'm very new to VBA, but learning from books and also from kind folks here
who help me patch together code for my needs. I don't even have all my
terminology correct yet.
I have a Progress Report that if run from the Report selector form runs
several queries that brings up all the data for each project. The user can
then click through each Progress report in order of ProjectID. The Progress
report is fairly complex with 4 subreports (each with it's own query) in it,
each refering to the same ProjectID, plus other ID's unique to it's
requirements as a subreport.
However sometimes it would be nice to be able to activate this Progress
Report, not from the Report selector form, but from the Project form itself,
with a command button, based on the ProjectID that is showing in that Project
form. That way the user wouldn't need to click through 20 or so project
reports to get to the one he needs.
I'm sure I could do this by doubling up on my queries, which would be
identical except for how the IDs are passed to them. In the first report, all
the ProjectIDs appear. In the second one, I'd like for just one set of IDs to
be passed. I'd like to use the same set of queries to serve both roles
instead of doubling up on them.
So it seems like somehow I need an If Then statement in my query that could
determine (this is my guess) from which form the command was executed
(me.form ?). If it was from the Report selector page, then run it for all the
ProjectIDs (as it presently does), or if it was from the Project form, then
run it just for the specific ProjectID on that form.
Could that code be written into the parameter or criteria for the query?
If so, any suggestions on what the code would be?
Thanks very much for taking the time to look at this.
Harold