yes or no fields

G

Guest

I have 3 yes or no fields, the first field is always a yes/Injury field and
the 2nd/Lost Time and 3rd field/Medical can be yes or no depending on what
action was taken with the injury. When I run the query it will only show
results if the 1st, 2nd, and 3rd field are checked as yes. I have some
fields where only the 1st field is a yes and there was no lost time or
medical care needed. It will not return results if there is a yes in just
the first field/Injury field. What am I doing wrong? I have set the
criteria being 0 or -1 several different ways but I can't see to bring up the
field resulting in "yes" in the 1st field and no in the 2nd and 3rd field.
Thanks
 
R

Rick B

First, why do you have the first field if it is always "yes"?

To fix your query, you would need to share it with us. My guess is that you
have criteria stating that field one must be -1, field 2 must be -1, and
field 3 must be -1. Since you simply want to pull all records, you don't
need any criteria under those fields.

If that does not help, please post the SQL view of your query here and we
will give you a more specific answer.
 
R

Rick B

I'm not real good with SQL and joins, but it looks like you are only pulling
data that has an entry in your "lost days" qry. My guess is that those
records would all have the second checkbox marked (and most likely the
third).

Maybe someone a bit more into SQL can jump in.

--
Rick B



Melinda said:
You are correct I do want all the results, the query will need to show
management is the employee has an injury(1st field), a lost time
injury(2nd
field) or an injury that needs medical attention(3rd field) When I run
the
query it returns results that have just a yes in field 1 and a yes in
field 2
or 3. It will not return results with just a yes in field 1.

SELECT TWPlostdaysqry.[Cost Center], DaysLostqry.EmployeeName,
DaysLostqry.DateofInjury, DaysLostqry.JobTitle,
DaysLostqry.NatureofInjury,
tblinjury.PS1, TWPlostdaysqry.[PS2-LostTime],
TWPlostdaysqry.[PS2-Medical],
DaysLostqry.BodyPart, DaysLostqry.Expr1, DaysLostqry.Expr2,
DaysLostqry.Expr3, DaysLostqry.Expr4, DaysLostqry.Expr5,
DaysLostqry.LostDays, TWPlostdaysqry.Expr1, TWPlostdaysqry.Expr2,
TWPlostdaysqry.Expr3, TWPlostdaysqry.TwpDays
FROM tblinjury, DaysLostqry INNER JOIN TWPlostdaysqry ON
DaysLostqry.EmployeeName = TWPlostdaysqry.EmployeeName
GROUP BY TWPlostdaysqry.[Cost Center], DaysLostqry.EmployeeName,
DaysLostqry.DateofInjury, DaysLostqry.JobTitle,
DaysLostqry.NatureofInjury,
tblinjury.PS1, TWPlostdaysqry.[PS2-LostTime],
TWPlostdaysqry.[PS2-Medical],
DaysLostqry.BodyPart, DaysLostqry.Expr1, DaysLostqry.Expr2,
DaysLostqry.Expr3, DaysLostqry.Expr4, DaysLostqry.Expr5,
DaysLostqry.LostDays, TWPlostdaysqry.Expr1, TWPlostdaysqry.Expr2,
TWPlostdaysqry.Expr3, TWPlostdaysqry.TwpDays;

Thanks for you help



Rick B said:
First, why do you have the first field if it is always "yes"?

To fix your query, you would need to share it with us. My guess is that
you
have criteria stating that field one must be -1, field 2 must be -1, and
field 3 must be -1. Since you simply want to pull all records, you don't
need any criteria under those fields.

If that does not help, please post the SQL view of your query here and we
will give you a more specific answer.
 
G

Guest

Thanks so much, I just returned from all the hustle and bustle. I tried the
join, but it as well did not return all my records. I ended up redoing the
query out of my injury table to eliminate the problem with the joins and it
worked. Thanks for your help

PJ said:
It looks like tblinjury and DaysLostqry aren't joined at all. You need to
join them on a field they have in common

FROM tblinjury
INNER JOIN DaysLostqry on tblinjury.[FIELD] = DaysLostqry.[FIELD]

-PJ

Melinda said:
thanks for your help, but I think it is in the joins also

Rick B said:
I'm not real good with SQL and joins, but it looks like you are only pulling
data that has an entry in your "lost days" qry. My guess is that those
records would all have the second checkbox marked (and most likely the
third).

Maybe someone a bit more into SQL can jump in.

--
Rick B



You are correct I do want all the results, the query will need to show
management is the employee has an injury(1st field), a lost time
injury(2nd
field) or an injury that needs medical attention(3rd field) When I run
the
query it returns results that have just a yes in field 1 and a yes in
field 2
or 3. It will not return results with just a yes in field 1.

SELECT TWPlostdaysqry.[Cost Center], DaysLostqry.EmployeeName,
DaysLostqry.DateofInjury, DaysLostqry.JobTitle,
DaysLostqry.NatureofInjury,
tblinjury.PS1, TWPlostdaysqry.[PS2-LostTime],
TWPlostdaysqry.[PS2-Medical],
DaysLostqry.BodyPart, DaysLostqry.Expr1, DaysLostqry.Expr2,
DaysLostqry.Expr3, DaysLostqry.Expr4, DaysLostqry.Expr5,
DaysLostqry.LostDays, TWPlostdaysqry.Expr1, TWPlostdaysqry.Expr2,
TWPlostdaysqry.Expr3, TWPlostdaysqry.TwpDays
FROM tblinjury, DaysLostqry INNER JOIN TWPlostdaysqry ON
DaysLostqry.EmployeeName = TWPlostdaysqry.EmployeeName
GROUP BY TWPlostdaysqry.[Cost Center], DaysLostqry.EmployeeName,
DaysLostqry.DateofInjury, DaysLostqry.JobTitle,
DaysLostqry.NatureofInjury,
tblinjury.PS1, TWPlostdaysqry.[PS2-LostTime],
TWPlostdaysqry.[PS2-Medical],
DaysLostqry.BodyPart, DaysLostqry.Expr1, DaysLostqry.Expr2,
DaysLostqry.Expr3, DaysLostqry.Expr4, DaysLostqry.Expr5,
DaysLostqry.LostDays, TWPlostdaysqry.Expr1, TWPlostdaysqry.Expr2,
TWPlostdaysqry.Expr3, TWPlostdaysqry.TwpDays;

Thanks for you help



:

First, why do you have the first field if it is always "yes"?

To fix your query, you would need to share it with us. My guess is that
you
have criteria stating that field one must be -1, field 2 must be -1, and
field 3 must be -1. Since you simply want to pull all records, you don't
need any criteria under those fields.

If that does not help, please post the SQL view of your query here and we
will give you a more specific answer.

--
Rick B



I have 3 yes or no fields, the first field is always a yes/Injury field
and
the 2nd/Lost Time and 3rd field/Medical can be yes or no depending on
what
action was taken with the injury. When I run the query it will only
show
results if the 1st, 2nd, and 3rd field are checked as yes. I have
some
fields where only the 1st field is a yes and there was no lost time or
medical care needed. It will not return results if there is a yes in
just
the first field/Injury field. What am I doing wrong? I have set the
criteria being 0 or -1 several different ways but I can't see to bring
up
the
field resulting in "yes" in the 1st field and no in the 2nd and 3rd
field.
Thanks
 

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