Another Data mis-match

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Another Data mis-match

Post by Egg 'n' Bacon »

I have tried allsorts, but I really am stuck as to why this (attached) does not work.

The chart used to work, and the underlying query works, until the last record is added. Strangely, this record is not selected in the first level query from which the chart query get's it's data from.

An ideas??
strippedDataMismatch.zip
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78573
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Another Data mis-match

Post by HansV »

I'm not sure why the DateSerial expression in the Row Source of the chart causes this error, but it works if you use

Closed: [DateClosed]-Day([DateClosed])+1

instead of

Closed: DateSerial(Year([DateClosed]),Month([DateClosed]),1)
Best wishes,
Hans

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Re: Another Data mis-match

Post by Egg 'n' Bacon »

Wow! I've found a chink in the encyclopedic knowledge and experience of the mighty Hans :duck:

But thank you for a solution :thankyou:

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: Another Data mis-match

Post by Pat »

He still wins Hans down though !!!!

User avatar
HansV
Administrator
Posts: 78573
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Another Data mis-match

Post by HansV »

Hans is seldom down! :grin:
Best wishes,
Hans

JohnH
3StarLounger
Posts: 287
Joined: 09 Mar 2010, 23:16
Location: Canberra Australia

Re: Another Data mis-match

Post by JohnH »

The problem is not actually with using DateSerial. If you remove the criterion >#12/31/2009# the DateSerial works correctly.
The problem is applying the criterion to the calculated field.
You can keep DateSerial by adding the DateClosed field and applying the criterion to that.

Applying criteria to calculated fields usually works, but if the calculation gets complicated it sometimes produces hand to understand errors.

Strangely, this record is not selected in the first level query from which the chart query get's it's data from.
Record 923 is the last record that is both counted and has a date closed, so it is the last record returned by the query.
Record 926 does not have a date closed.
Regards

John

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Re: Another Data mis-match

Post by Egg 'n' Bacon »

JohnH wrote:The problem is not actually with using DateSerial. If you remove the criterion >#12/31/2009# the DateSerial works correctly.
The problem is applying the criterion to the calculated field.
You can keep DateSerial by adding the DateClosed field and applying the criterion to that.

Applying criteria to calculated fields usually works, but if the calculation gets complicated it sometimes produces hand to understand errors.

Strangely, this record is not selected in the first level query from which the chart query get's it's data from.
Record 923 is the last record that is both counted and has a date closed, so it is the last record returned by the query.
Record 926 does not have a date closed.
I could have sworn I tried that.

Any idea why it threw up the error?

User avatar
HansV
Administrator
Posts: 78573
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Another Data mis-match

Post by HansV »

I guess that the query optimizer attempts to combine the queries; this causes a problem because DateSerial(Null,Null,1) can't be evaluated.
Best wishes,
Hans