Les Isaacs
Registered User.
- Local time
- Today, 19:32
- Joined
- May 6, 2008
- Messages
- 186
Hi All
I'm no expert, but I think I've found a bug in access's query builder
I have a query with 4 rows of criteria, with the same value in 3 of the fields (these 4 criterion must be satisfies in every case), and varying values in values on one row only in 4 other fields: so the 3 criteria must be satisfied in every case, plus any 1 of the 3 criteria.
One of the 4 'must be satisfied' criteria is for a numerical field to be >0, so I set >0 on each of the 4 rows. I save the query. I save the query again. I close the query. I open the query and hey presto, my 4 '>0' criterion are now all on one row - i.e. >0 or >0 or >0 or >0
This is obviously not going to return the same (correct) results as I get with the '>0' set on each of the 4 rows.
Is it a bug?
Am I the first to identify this?
Is there a prize?
Hope someone can help (and probably make me feel foolish
)
In casse anyone wants/needs to see the query, the sql is below.
Thanks
Les
SELECT Sum([x confirmed_local].[nhsp ees]) AS [SumOfnhsp ees], staffs.staff_name, practices.[prac name], Format([joined nhpps],"ddmmyyyy") AS [Date of Commencement], staffs.[joined nhpps], staffs.[SA number] AS [SD NO], staffs.[NI number] AS [NI No], staffs.NHSP_updated_to, inyearstarter("",[staffs].[staff_name]) AS Starter
FROM (practices INNER JOIN staffs ON practices.[prac name] = staffs.practice) INNER JOIN (months INNER JOIN [x confirmed_local] ON months.[month name] = [x confirmed_local].[month name]) ON staffs.staff_name = [x confirmed_local].staff_name
WHERE (((Format([joined nhpps],"ddmmyyyy")) Is Null) AND ((months.year)=[Forms]![frm x main]![year]) AND ((staffs.[leaving date]) Is Null Or (staffs.[leaving date])>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.nhsp_leaving_date) Is Null Or (staffs.nhsp_leaving_date)>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.NHSP_updated_to)<CDate("31 " & [forms]![frm x main]![month name]))) OR (((months.year)=[Forms]![frm x main]![year]) AND ((staffs.[leaving date]) Is Null Or (staffs.[leaving date])>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.nhsp_leaving_date) Is Null Or (staffs.nhsp_leaving_date)>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.NHSP_updated_to)<CDate("31 " & [forms]![frm x main]![month name])) AND ((staffs.[SA number]) Is Null)) OR (((months.year)=[Forms]![frm x main]![year]) AND ((staffs.[leaving date]) Is Null Or (staffs.[leaving date])>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.nhsp_leaving_date) Is Null Or (staffs.nhsp_leaving_date)>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.NHSP_updated_to)<CDate("31 " & [forms]![frm x main]![month name])) AND ((staffs.[NI number]) Is Null)) OR (((months.year)=[Forms]![frm x main]![year]) AND ((staffs.[leaving date]) Is Null Or (staffs.[leaving date])>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.nhsp_leaving_date) Is Null Or (staffs.nhsp_leaving_date)>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.NHSP_updated_to) Is Null))
GROUP BY staffs.staff_name, practices.[prac name], Format([joined nhpps],"ddmmyyyy"), staffs.[joined nhpps], staffs.[SA number], staffs.[NI number], staffs.NHSP_updated_to, inyearstarter("",[staffs].[staff_name])
HAVING (((Sum([x confirmed_local].[nhsp ees]))>0)) OR (((Sum([x confirmed_local].[nhsp ees]))>0)) OR (((Sum([x confirmed_local].[nhsp ees]))>0)) OR (((Sum([x confirmed_local].[nhsp ees]))>0));
I'm no expert, but I think I've found a bug in access's query builder
I have a query with 4 rows of criteria, with the same value in 3 of the fields (these 4 criterion must be satisfies in every case), and varying values in values on one row only in 4 other fields: so the 3 criteria must be satisfied in every case, plus any 1 of the 3 criteria.
One of the 4 'must be satisfied' criteria is for a numerical field to be >0, so I set >0 on each of the 4 rows. I save the query. I save the query again. I close the query. I open the query and hey presto, my 4 '>0' criterion are now all on one row - i.e. >0 or >0 or >0 or >0
This is obviously not going to return the same (correct) results as I get with the '>0' set on each of the 4 rows.
Is it a bug?
Am I the first to identify this?
Is there a prize?
Hope someone can help (and probably make me feel foolish
In casse anyone wants/needs to see the query, the sql is below.
Thanks
Les
SELECT Sum([x confirmed_local].[nhsp ees]) AS [SumOfnhsp ees], staffs.staff_name, practices.[prac name], Format([joined nhpps],"ddmmyyyy") AS [Date of Commencement], staffs.[joined nhpps], staffs.[SA number] AS [SD NO], staffs.[NI number] AS [NI No], staffs.NHSP_updated_to, inyearstarter("",[staffs].[staff_name]) AS Starter
FROM (practices INNER JOIN staffs ON practices.[prac name] = staffs.practice) INNER JOIN (months INNER JOIN [x confirmed_local] ON months.[month name] = [x confirmed_local].[month name]) ON staffs.staff_name = [x confirmed_local].staff_name
WHERE (((Format([joined nhpps],"ddmmyyyy")) Is Null) AND ((months.year)=[Forms]![frm x main]![year]) AND ((staffs.[leaving date]) Is Null Or (staffs.[leaving date])>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.nhsp_leaving_date) Is Null Or (staffs.nhsp_leaving_date)>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.NHSP_updated_to)<CDate("31 " & [forms]![frm x main]![month name]))) OR (((months.year)=[Forms]![frm x main]![year]) AND ((staffs.[leaving date]) Is Null Or (staffs.[leaving date])>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.nhsp_leaving_date) Is Null Or (staffs.nhsp_leaving_date)>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.NHSP_updated_to)<CDate("31 " & [forms]![frm x main]![month name])) AND ((staffs.[SA number]) Is Null)) OR (((months.year)=[Forms]![frm x main]![year]) AND ((staffs.[leaving date]) Is Null Or (staffs.[leaving date])>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.nhsp_leaving_date) Is Null Or (staffs.nhsp_leaving_date)>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.NHSP_updated_to)<CDate("31 " & [forms]![frm x main]![month name])) AND ((staffs.[NI number]) Is Null)) OR (((months.year)=[Forms]![frm x main]![year]) AND ((staffs.[leaving date]) Is Null Or (staffs.[leaving date])>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.nhsp_leaving_date) Is Null Or (staffs.nhsp_leaving_date)>CDate("31/3/" & Right([forms]![frm x main]![year],2))) AND ((staffs.NHSP_updated_to) Is Null))
GROUP BY staffs.staff_name, practices.[prac name], Format([joined nhpps],"ddmmyyyy"), staffs.[joined nhpps], staffs.[SA number], staffs.[NI number], staffs.NHSP_updated_to, inyearstarter("",[staffs].[staff_name])
HAVING (((Sum([x confirmed_local].[nhsp ees]))>0)) OR (((Sum([x confirmed_local].[nhsp ees]))>0)) OR (((Sum([x confirmed_local].[nhsp ees]))>0)) OR (((Sum([x confirmed_local].[nhsp ees]))>0));