Unwanted info in query

J

John Spencer

The results you got are what was asked for- all volunteers at Ferndale. If
you want all volunteers, you must drop the criteria for Ferndale.

SELECT Employees.[First Name]
, Employees.[Last Name]
, Employees.Volunteer
, Employees.Ferndale
FROM Employees
WHERE Volunteer = True

I can see by our discussion that you have a very limited understanding of
queries and query criteria. If at all possible, I would suggest you find a
course on using Access or buy a beginner-level book on Access. A little
study will go a long way to helping you accomplish what you need to do.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

John Spencer said:
How do you know if someone is a volunteer Do you have a field that tells
you this?

TRY the following - it should display only those employees at Ferndale who
are volunteers. This assumes tht Volunteer is a checkbox field just like
Ferndale is a checkbox.

SELECT Employees.[First Name]
, Employees.[Last Name]
, Employees.Volunteer
, Employees.Ferndale
FROM Employees
WHERE Employees.Ferndale=True
AND Volunteer = True

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.

Rhianne said:
I copied and pastied what you left below and now when I open my query it
has
everyone as based at Ferndale (we have two brances Ferndale and
Aberdare),
and it still is showing all staff - not just volunteers.

I think I am slowly going mad..............

John Spencer said:
NO QUOTES if FernDale is a YES/No field which checkboxes are normally
based
on a Yes/No field

SELECT Employees.[First Name]
, Employees.[Last Name]
, Employees.Volunteer,
Employees.Ferndale
FROM Employees
WHERE (((Employees.Ferndale)=TRUE));

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

SELECT Employees.[First Name], Employees.[Last Name],
Employees.Volunteer,
Employees.Ferndale
FROM Employees
WHERE (((Employees.Ferndale)="true"));

I included the "true" in volunteer column's criteria - as per
instructions.
If I enter false, then it is the same outcome.

Thanks.


:

Please post the SQL of the query that is showing no records returned.
Perhaps you are doing something other than what I expect when you are
inputting the criteria.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

In design view it does not show -1 or anything else. It is when it
is
in
table view (the particular) query that in the volunteer column (I
have
at
least 6 differing staff types) shows -1. When I open design and
amend
the
criteria in the relevant column to -1 or true or false, when I
reopen
the
query in table view, nothing appears apart from the empty columns,
with
the
appropriate headings.



:

OPEN the table in design view.
FIND the field
WHAT is the field type of the field that is showing -1? Does this
field
ever show any other value? Or does it only show -1 and blank?

Your posted query doesn't show a field (column) that is entitled
Staff
Type.
Is one of the fields shown the staff type or is that another
field?

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

I have obsolutely no idea what you just asked me.

The query is "working" it just is displaying all the names in
the
database -
it does show a -1 in the staff type column (whilst in table
view)
but I
do
not want this. I only want volunteer or paid staff etc to be
shown.Does
this
make sense?


SELECT Employees.[First Name], Employees.[Last Name],
Employees.Placement,
Employees.Ferndale
FROM Employees;

This is not doing what I want it to do.

I do understand what you mean by field type. In form view my
staff
type
is
selected by check boxes which are bound to a table???

Sorry to sound so confusing!

:

Check boxes can be bound to a boolean (Yes/No) field or to a
number
field.
You did not answer my question about the field type.

This is the query you originally posted.
SELECT Employees.[First Name]
, Employees.[Last Name]
, Employees.Volunteer
FROM Employees

What values does it return for Volunteer?
Are the values left-aligned or right-aligned?
Please post the query you are using that isn't working.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

That isn't working either. In my database's form view, the
selection
for
staff type is check boxes.

I really really don't want to have to change the design of my
database
again.

What else can I do?

:

Open your Employees table in design view
What type of field is Volunteer? Is it a number field, a
yes/no
field,
or a
text field?

If it is a Yes/No field then the answer I gave you
previously
should
apply.
As a test change TRUE to FALSE and see if you get all the
records
back.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

message
I have typed in true and now all my information has
disappeared
from
the
query. What else should i be doing - I don't really want
to
have
to
change
the design of the database.

:

It sounds as if you have three fields to show Staff
type -
Paid,
Volunteer,
Placement? Is that true?

To show just the records where Volunteer is checked you
would
need
a
query
like:
SELECT Employees.[First Name], Employees.[Last Name],
Employees.Volunteer
FROM Employees
WHERE Volunteer = True

In Design view
Field: Volunteer
Criteria: True

Your table design would be better if you had one field
for
staff
type
and
stored a value of Volunteer, Paid, or Placement in that
field.
A
big
advantage to this would be if another type of staff was
added
(Part
time,
Full Time) then all you would need to do would be to
enter
that
into
staff
type. With what I suspect is the current design, you
would
need
to
redesign
your tables, forms, queries, and reports to handle the
addition
of
a
new
staff type.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

message
SELECT Employees.[First Name], Employees.[Last Name],
Employees.Volunteer
FROM Employees;

Does it make a difference that the selection of staff
type
is
a
check
box?
In table view it is demonstrated by a -1, this isn't a
problem
just
want
to
be able to get rid of unwanted names!

Thanks for speedy response!

:

Please copy and post the SQL of your query.

(Possibly unneeded instructions follow)
Open the query
Select View:Sql from the Menu
Select all the text
Copy it
Paste it into the message

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

message
I have a Personnel database that I have created
queries
from,
so
as
to
show
relevant information for certain data I need to
collect
and
show.
However
there seems to be a problem, for example I would
like to
base
a
query
on
staff type (we have paid, volunteer and placement),
I
need
to
be
able
to
show
only paid, only volunteer etc. However even if I
only
select
Volunteer
for
the tables I want included in my query - it shows
all
the
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top