Your database design almost surely is not correct. Rather than all of those
check boxes (and Yes/No fields) you would do better to store the information
in a related table.
Working within the limitations of your current design, you stated earlier
that you "have the form with all the check boxes on and the form which holds
the database information". A form does not hold information (except
temporarily while the form is open). Tables hold information.
The form "with all the checkboxes on" should be an unbound form (I will call
it frmSearch) if you are using it to set up the record source for "the form
which holds the database information".
The form that holds the database information (I will call this form frmMain)
is bound a query based on the table that holds the Yes/No fields and the
rest of the information. I will call this table tblMain.
Back to the unbound form frmSearch. Each check box corresponds to a Yes/No
field in tblMain. I will call the table fields Check1, Check 2, etc., and
the check boxes on frmSearch chkCheck1, chkCheck2, etc. Add a command
button to open frmMain. The wizard can help with this.
You need a query based on frmMain. If you do not have this query, go to the
database window and create a query in design view. Choose the table
tblMain. Add all of the fields from the table, one by one. In the Criteria
row below Check1 (the name I am giving to your first Yes/No field), put
this:
Forms![frmSearch]![chkCheck1]
If you checked the check box chkCheck1 on frmSearch, the query will return
only the records for which Check1 is True (or Yes).
Do the same for the rest of the Yes/No fields. Save the query (I will call
it qryMain).
Base frmMain on qryMain. That is, use qryMain as its Record Source.
To use, select the desired check boxes on frmSearch, and click the command
button to open frmMain. The query (qryMain) will look at the check boxes on
frmSearch, and will return only the records that match the frmSearch
selections. If you checked Yes in chkCheck1 and chkCheck2 on frmSearch, and
left the rest of the check boxes unchecked, qryMain will return only the
records in which Check1 and Check2 are Yes and the rest of the Yes/No fields
are No. Remember, frmMain is based on qryMain, so on frmMain you will see
only the records that are in qryMain.
rsw1984 said:
Hi Bruce
Basically I need to be able to determine weather someone is an expert in a
particular field. So far I have around 50 check boxes which I need to be
able to filter. I need to search for certain experts for a guideline
group.
The check boxes are to say that the person is actually an expert in a
specific field. I hope this gives some more information about what I need
to
achieve.
Thanks
Richard
BruceM said:
You have to describe something of the database's purpose and structure.
In
particular, what is the table in which these Yes/No fields occur, and
what
choice is being made by checking the box? All of the replies in this
thread
have been in terms of made-up table, form, query, and field names.
Rather
than me or Dave continuing to attempt to explain by assigning the
database a
hypothetical purpose, and the table and check boxes arbitrary names,
state
in real-world terms what you hope to accomplish.
If you are unusre what a reply means, be specific about what puzzles you
rather than asking volunteers to attempt a new explanation starting from
the
beginning. People reply to questions in this forum because they are
willing
to help (as many of us have been helped in the past), but since the
generic
reply is not getting it done, you as the person with the question have to
provide enough details that the response can be specifc.
Sorry Bruce
Could you please simplify this process.
As I am unsure of what you mean.
Thanks
:
Let's say your search parameters form is named frmFind, and the form
with
the filtered recordset is frmMain. frmFind is unbound, and frmMain is
bound
to qryMain, which is based on the table containing the records you
want
to
filter. You can open frmFind, select the check boxes, then click a
button
to open frmMain. For this example, the check boxes have the same
names
on
both form.
frmMain is based on the query qryMain, which includes the fields
(columns)
Check1, Check2, etc. In the Criteria row for Check 1:
Forms![frmFind]![Check1]
Similarly for Check2:
Forms![frmFind]![Check1]
After selecting the check boxes on frmFind, click a command button to
open
frmMain. The command button wizard can help with this. If you would
rather
not use the wizard, add code something like this to the command
button's
Click event:
DoCmd.OpenForm "frmMain"
Me.Form.Visible = False
Hiding the form is optional. Try it without first.
Since frmMain is based on qryMain, and qryMain has criteria based on
the
frmMain selections, frmMain will display only the records with check
boxes
matching those on frmFind.
If you have frmMain open and want to perform another search, a command
button on frmMain can unhide frmFind:
Forms![frmFind].Visible = True
If you are going with this approach, after selecting the check boxes
on
frmFind you probably need to see if frmMain is already open. If it
is,
requery it; if not, open it. The command button on frmFind, rather
than
simply opening frmMain as described above, will instead have something
like:
If CurrentProject.AllForms("frmMain").IsLoaded Then
Forms![frmMain].Requery
Else
DoCmd.OpenForm "frmMain"
End If
Unfortunately this isn't actually only bringing up the entries that
collaborate with the entries I'm searching for! What I'm rtrying to
do
is
filter the results using the check boxes.
:
No, you don't need a search button on the database form.
If you are using a table as the record source for the database
form,
you
need to change it to a query. Then for each check box field in
the
query,
you need to enter the name of the form and the control on the check
box
form
that relates to that check box field.
For example, lets say that in your table, you have a field named
CheckOne.
One the check box form lets say you have a control named txtCheck01
and
that
when you check that check box, you want all the records that have
the
field
CheckOne checked in the table to be included in the records for the
database
form.
So in your query, you would find the column for the field CheckOne.
In
that
column in the Criteria row, you would reference the check box on
the
check
box form by putting the form name and control name it relates to.
For
example, it this case, it would be:
Forms!CheckBoxFormName!txtCheck01
You would do the same for each check box on the check box form.
--
Dave Hargis, Microsoft Access MVP
:
I have the form with all the check boxes on and the form which
holds
the
database information. Do I need to create a search button on the
database
form?
That's as far as I have got so far!!
:
You mentioned two forms.
One that is open and has the check boxes on it.
The other is a form you want to open and filter records so only
those
that
have the check box fields check that match the check boxes on
the
first form.
Is that correct?
Tell me what you have done so far, so I know where to start.
--
Dave Hargis, Microsoft Access MVP
:
Dave
Let's say that I'm useless at this and have not done it
before.
How then
would I do it? Speak to me like the idiot that I am. I have
some
more basic
knowledge but is it possible for step by step process please.
Thanks
:
For the form you bring up on top (Form1), create a query as
its
Record Source.
Include all the check boxes on Form1 in the query.
In the Criteria row of the query, put the name of the
control
on
Form1 the
check box is bound to:
Field: Check1 Check2
Criteria: Forms!Form1!txtCheck1 Forms!Form1!txtCheck2
and so on.
--
Dave Hargis, Microsoft Access MVP
:
Hi
Could someone please assist? I currently have a form
with
various check
boxes. I was wondering if it was possible to create a
form
on
top of this
and have a list of all the check boxes that when a
combination
were checked
would bring up the records with the same combination
behind
on
the main form.
Am I asking too much from access by requesting this.
If some one does know the answer please reply in basic
terms
as
I easily get
confused.