Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Problem

Status
Not open for further replies.

ICCIIT

Technical User
Jul 21, 2003
62
GB
I have a table in Access for which I wish to build a query, one of the fields includes a number of between 0 – 99 and another field is populated via a tick box on a form so is true or false.

I wish to build the query to show all records >40 and all records that are true, I have built the query and can get one or the other but not together as the true includes records that are below 40.

Where am I going wrong?

Thanks
 
Use the same criteria row in the query to set the two criteria. If you can't figure this out, reply back with your SQL view.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Did not work, SQL below

SELECT Tbl_Entity_Detail.Name, Tbl_Entity_Detail.Cell_Name, tbl_Risk_Data.Analysis_Date, tbl_Risk_Data.Total_Grand, tbl_Risk_Data.Total_Band, tbl_Risk_Data.Enhanced_Monitoring
FROM qry_Rep_Group_By INNER JOIN (Tbl_Entity_Detail INNER JOIN tbl_Risk_Data ON Tbl_Entity_Detail.ID = tbl_Risk_Data.Licensee_ID) ON (qry_Rep_Group_By.Licensee_ID = tbl_Risk_Data.Licensee_ID) AND (qry_Rep_Group_By.MaxOfAnalysis_Date = tbl_Risk_Data.Analysis_Date)
GROUP BY Tbl_Entity_Detail.Name, Tbl_Entity_Detail.Cell_Name, tbl_Risk_Data.Analysis_Date, tbl_Risk_Data.Total_Grand, tbl_Risk_Data.Total_Band, tbl_Risk_Data.Enhanced_Monitoring
HAVING (((tbl_Risk_Data.Total_Grand)>40 And "Enhanced_Monitoring"=True))
ORDER BY Tbl_Entity_Detail.Name, Tbl_Entity_Detail.Cell_Name;
 
Replace this:
"Enhanced_Monitoring"
with this:
tbl_Risk_Data.Enhanced_Monitoring

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi

Tried the above, but now no result is shown, not sure if I made my first post clear, most of the records that show true will be under 40 and I need it to return all records above 40 on tbl_Risk_Data.Total_Grand and all records that show true under tbl_Risk_Data.Enhanced_Monitoring.

Thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top