Group:  Microsoft Access ยป microsoft.public.access.gettingstarted
Thread: Queries for a report

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Queries for a report
keameyer <keameyer.2b4g5o[ at ]officefrustration.com> 17.07.2006 17:44:53
I have a database that I would like the user to select an item from a dropdown list and then run a query on a different table to generate a report for the user, does anyone know how I can do this? -- keameyer
Re: Queries for a report
Nikos Yannacopoulos <nyannacoREMOVETHIS[ at ]gmail.com> 18.07.2006 07:16:37
While this can easily be done with a little VBA code, your data design
is questionable; your post implies that you have several tables with the
same design (same fields), but holding data for different entities? For
instance, you have different Sales tables, each holding data for a
different region?
If that is indeed the case, then your design is not correct: you are
effectively storing data implicitly in the table names, as the only
piece of information specifying which region a sale belongs to, is the
table it is stored in. This is bound to get you into trouble, your
current question being just the tip of the iceberg. The right way to do
it is store all data in a single table, with an extra field for region;
then all you need to do is filter on this field in a query.
In case I have misinterpreted your question, please clarify. If I have
not, please elaborate on your current design for more specific help if
required.

HTH,
Nikos
Re: Queries for a report
Kate Williams <Kate.Williams.2b6atp[ at ]officefrustration.com> 18.07.2006 15:46:38
keameyer Wrote: > I have a database that I would like the user to select an item from a > dropdown list and then run a query on a different table to generate a > report for the user, does anyone know how I can do this?

You'll need to set up the criteria for the query so it looks in the control on the form:

like [Forms]![Form Name]![Control Name].

Base the report on the query.

Put a button on the form and add an event procedure to "on click"

DoCmd.OpenReport "Report Name", acviewpreview

N.B. if you use acviewnormal the report will not open and instead just go straight to the default printer.

Kate -- Kate Williams

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net