Append Access Reports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I understand that it's not possible to run a query using a multiple list box.

I can achieve the same end by appending reports.

Is there a way to append reports?
 
Better let my users know they can't be doing what they've been doing... <g>

You CAN run a query/report incorporating multiple selections from a list
box. You have to create the SQL statement of that query "dynamically",
however.

If you had, say, three items selected, your SQL statement might say:

WHERE ... AND (([YourField] = 7( or ([YourField] = 8) or ([YourField] =
9)) ...

or it could use:

WHERE ... And ([YourField] In (7,8,9))

Regards

Jeff Boyce
<Office/Access MVP>
 
Wow...that would work perfectly...can you expand on that code? I'm a bit of
a novice so am not quite getting what you're telling me do.

I'm trying to run reports where a user will choose particular analysts to
include in the report.

Like analyst1, analyst2, analyst3, etc.

Jeff Boyce said:
Better let my users know they can't be doing what they've been doing... <g>

You CAN run a query/report incorporating multiple selections from a list
box. You have to create the SQL statement of that query "dynamically",
however.

If you had, say, three items selected, your SQL statement might say:

WHERE ... AND (([YourField] = 7( or ([YourField] = 8) or ([YourField] =
9)) ...

or it could use:

WHERE ... And ([YourField] In (7,8,9))

Regards

Jeff Boyce
<Office/Access MVP>

Gee... said:
I understand that it's not possible to run a query using a multiple list
box.

I can achieve the same end by appending reports.

Is there a way to append reports?
 
The code is really just "aircode" (untested, your mileage may vary) and has
at least one typo I spotted when I looked it back over.

If you have a listbox, you have a form, right? On that form, you could
have/add a button that opens your report, using DoCmd.OpenReport syntax
(check Access HELP for this).

One of the syntax elements is a "Where" string, without the word "WHERE"
(again, check HELP for help). This would allow you to specify the criteria
on the form, open the report, and basically "filter" it to match the
criteria selected.

You'll need to learn a bit about "code behind form" to be able to add this
in (and understand how to troubleshoot it when it breaks!).

Good luck!

Jeff Boyce
<Office/Access MVP>

Gee... said:
Wow...that would work perfectly...can you expand on that code? I'm a bit
of
a novice so am not quite getting what you're telling me do.

I'm trying to run reports where a user will choose particular analysts to
include in the report.

Like analyst1, analyst2, analyst3, etc.

Jeff Boyce said:
Better let my users know they can't be doing what they've been doing...
<g>

You CAN run a query/report incorporating multiple selections from a list
box. You have to create the SQL statement of that query "dynamically",
however.

If you had, say, three items selected, your SQL statement might say:

WHERE ... AND (([YourField] = 7( or ([YourField] = 8) or ([YourField]
=
9)) ...

or it could use:

WHERE ... And ([YourField] In (7,8,9))

Regards

Jeff Boyce
<Office/Access MVP>

Gee... said:
I understand that it's not possible to run a query using a multiple list
box.

I can achieve the same end by appending reports.

Is there a way to append reports?
 
Back
Top