Creating Reports Based Upon Criteria Selection at Runtime

  • Thread starter Thread starter Don
  • Start date Start date
D

Don

Hello,

I'm relatively new to Access development. I've got several fields in
a database that are boolean, and I have buttons on a form
corresponding to those.

Basically what I'm trying to do is when buttons are clicked down (yes)
I want to be able to generate a report that only has records that
match this criteria. Currently, all records are displayed no matter
what.

There are more advanced criteria of course, but this is just an
example in order to gain some help. I was attempting to get it
working with Filters, but I am either doing it wrong, or there is
another way to do it.

Any help would be greatly appreciated!

Thanks!
 
Add criteria to the query in your report, to reference the objects on the
original form.

eg. fieldname=forms![form name]![object name]
 
I'm assuming these are toggle buttons?

SELECT Table1.*
FROM Table1
WHERE (((Table1.Bool1)=[Forms]![Form1]![Toggle0]) AND
((Table1.Bool2)=[Forms]![Form1]![Toggle1]) AND
((Table1.Bool3)=[Forms]![Form1]![Toggle2]));

Where "Table1" is the name of your table, "Bool1" to "Bool3" are the names
of your fields, "Form1" is the name of your form, and "Toggle0" to "Toggle2"
are the names of your toggle buttons. The form must be open when the query
runs.

BTW: I just discovered while testing this that on my notebook, with Windows
XP Themes active, it is impossible to distinguish between a toggle button
that is depressed and one that is not. I'm inclined to recommend check boxes
instead, as the difference between a checked and unchecked check box is more
visible.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Back
Top