Re: yes or no fields

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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" <Melinda@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3D9B6925-45CB-41BF-92C0-124C805906B6@xxxxxxxxxxxxxxxx
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" wrote:

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



"Melinda" <Melinda@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D96A2DC8-1032-4409-839C-FA94D6017502@xxxxxxxxxxxxxxxx
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





.



Relevant Pages

  • Re: SQL Syntax Error
    ... match all the criteria you input. ... SQL view and never open it in the query grid view. ... The syntax for the "where" statement is incorrect becuase of this. ...
    (microsoft.public.access.queries)
  • Re: Using combo box to search form
    ... "Jeff Boyce" wrote: ... Since you "started adding" additional criteria, ... about SQL syntax to know how to form a grammatically-correct SQL statement. ... One way to do that is to see what Access generates when you build a query. ...
    (microsoft.public.access.formscoding)
  • Re: Adjusting SQL in Query
    ... from the RESPEL table which satisfy the criteria in the PRICELIST Table. ... RESPEL INNER JOIN PRICELIST ON RESPEL.PRICELIST = ... Subject: Adjusting SQL in Query ...
    (microsoft.public.access.queries)
  • Re: Criteria linked to form combo Yes/No or All expression help
    ... The way I'd debug it would be to start w/ one OR clause in the criteria. ... Run the query & see if it works for that criteria. ... I followed your suggestion of pasting the sql, ...
    (microsoft.public.access.queries)
  • Re: Using combo box to search form
    ... Since you "started adding" additional criteria, ... about SQL syntax to know how to form a grammatically-correct SQL statement. ... One way to do that is to see what Access generates when you build a query. ... Dim strWhere As String ...
    (microsoft.public.access.formscoding)