473,780 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

expression is typed incorrectly

Good morning, I need a little help, I keep getting this error when I run this
report. I have narrowed it down to the query (sql view) listed below. the
error is: "This expression is typed incorrectly, or it is too complex to be
evaluated"

SELECT ActiveBranch.[Branch Name], -Sum([MthEnd]/[MonthClosingUni t]) AS
[AncillaryFee$MT D], -Sum([YTD]/[YTDClosingUnit]) AS [AncillaryFee$YT D], -Sum(
[MthEnd]/[MonthClosingVol ume])*10000 AS AncillaryFeeBps MTD, -Sum([YTD]/
[YTDClosingVolum e])*10000 AS AncillaryFeeBps YTD, Sum(-[MthEnd]) AS
TotalExpMthly, Sum(-[YTD]) AS TotalExpYTD
FROM (tblACPLTrialBa lanceHistory INNER JOIN ActiveBranch ON
tblACPLTrialBal anceHistory.Cos tCenter = ActiveBranch.Co stCenter) INNER JOIN
tblGENRClosingS ummary ON ActiveBranch.Co stCenter = tblGENRClosingS ummary.
CostCenter
WHERE (((tblACPLTrial BalanceHistory. ActgPeriod) Between [Forms]!
[frmACLSRptsMTDY TD]![MthBegDt] And [Forms]![frmACLSRptsMTDY TD]![MthEndDt])
AND ((tblACPLTrialB alanceHistory.[GLAcct#])="300610" Or
(tblACPLTrialBa lanceHistory.[GLAcct#])="300611" Or
(tblACPLTrialBa lanceHistory.[GLAcct#])="300802" Or
(tblACPLTrialBa lanceHistory.[GLAcct#])="300899" Or
(tblACPLTrialBa lanceHistory.[GLAcct#])="300999" Or
(tblACPLTrialBa lanceHistory.[GLAcct#])="300902"))
GROUP BY ActiveBranch.[Branch Name];
Any help would be greatly appreciated

Christine

--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200604/1
Apr 28 '06 #1
14 5002
cvollberg via AccessMonster.c om wrote:
Good morning, I need a little help, I keep getting this error when I run this
report. I have narrowed it down to the query (sql view) listed below. the
error is: "This expression is typed incorrectly, or it is too complex to be
evaluated"

SELECT ActiveBranch.[Branch Name], -Sum([MthEnd]/[MonthClosingUni t]) AS
[AncillaryFee$MT D], -Sum([YTD]/[YTDClosingUnit]) AS [AncillaryFee$YT D], -Sum(


What are you trying to do with " -Sum("? Get a negative value?

Try -1 * sum(whatever) instead. Same thing with the - in front of your
field expressions as well.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Apr 28 '06 #2
this calculates fees that are then added to the loan amount. Not sure why
they built it this way I just took it over. It worked fine a week ago and
then we got this error. I will try your solution and let you know. Thanks

Tim Marshall wrote:
Good morning, I need a little help, I keep getting this error when I run this
report. I have narrowed it down to the query (sql view) listed below. the

[quoted text clipped - 3 lines]
SELECT ActiveBranch.[Branch Name], -Sum([MthEnd]/[MonthClosingUni t]) AS
[AncillaryFee$MT D], -Sum([YTD]/[YTDClosingUnit]) AS [AncillaryFee$YT D], -Sum(


What are you trying to do with " -Sum("? Get a negative value?

Try -1 * sum(whatever) instead. Same thing with the - in front of your
field expressions as well.


--
Message posted via http://www.accessmonster.com
Apr 28 '06 #3
Using the -1* did not change the result and we still got the error

cvollberg wrote:
this calculates fees that are then added to the loan amount. Not sure why
they built it this way I just took it over. It worked fine a week ago and
then we got this error. I will try your solution and let you know. Thanks
Good morning, I need a little help, I keep getting this error when I run this
report. I have narrowed it down to the query (sql view) listed below. the

[quoted text clipped - 6 lines]
Try -1 * sum(whatever) instead. Same thing with the - in front of your
field expressions as well.


--
Message posted via http://www.accessmonster.com
Apr 28 '06 #4
Tim Marshall wrote:
Best way to do this is write
another query with the same from and where clause buy not a select query

I meant to say: "Best way to do this is write
another query with the same from and where clause but not a group by
query", ie, drop the group by clause and don't use sum()

Believe it or not, English *IS* my mother tongue!!!
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Apr 28 '06 #5
cvollberg via AccessMonster.c om wrote:
Using the -1* did not change the result and we still got the error


Rats.

Since it was working previously and hasn't been changed (you're
absolutely sure it hasn't changed?), the next thing I'd check very
carefully is to ensure that there is absolutely no way a zero can be in
any of the denominators you're using. Best way to do this is write
another query with the same from and where clause buy not a select query
- this is air sql here, pasted from your original:

SELECT ActiveBranch.[Branch Name], MonthClosingUni t, YTDClosingUnit,
MonthClosingVol ume
FROM (tblACPLTrialBa lanceHistory INNER JOIN ActiveBranch ON
tblACPLTrialBal anceHistory.Cos tCenter = ActiveBranch.Co stCenter) INNER JOIN
tblGENRClosingS ummary ON ActiveBranch.Co stCenter = tblGENRClosingS ummary.
CostCenter
WHERE (((tblACPLTrial BalanceHistory. ActgPeriod) Between [Forms]!
[frmACLSRptsMTDY TD]![MthBegDt] And [Forms]![frmACLSRptsMTDY TD]![MthEndDt])
AND ((tblACPLTrialB alanceHistory.[GLAcct#])="300610" Or
(tblACPLTrialBa lanceHistory.[GLAcct#])="300611" Or
(tblACPLTrialBa lanceHistory.[GLAcct#])="300802" Or
(tblACPLTrialBa lanceHistory.[GLAcct#])="300899" Or
(tblACPLTrialBa lanceHistory.[GLAcct#])="300999" Or
(tblACPLTrialBa lanceHistory.[GLAcct#])="300902"))

If there ary zeros in the above, this could be causing it.

Other than those two things, nothing else immediately jumps out at me.
You'd then need to trouble shoot it by examining the query structure.

The approach I'd then take is slowly reconstructing the original query
in several ways. For example, starting with just one of the
fields/calulated fields in the select clause running it and seeing if
it's OK, then trying it with another component of the current select
clause by itself and then combining the tested fields and so on. The
same thing could then be done separately or in conjunction with the
previous sentence with items in the where clause - try it without any
where clause, build up one condition at a time.

I'd probably concentrate on doing the "slow build" approach with the
select clause first

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Apr 28 '06 #6
OK, there is 0's in the numbers so that if probably what is causing the error,
isn't there a statement I can put in front of the equations that will allow
them and not cause the error, what is really funny the report comes out right.
Thanks

Tim Marshall wrote:
Using the -1* did not change the result and we still got the error


Rats.

Since it was working previously and hasn't been changed (you're
absolutely sure it hasn't changed?), the next thing I'd check very
carefully is to ensure that there is absolutely no way a zero can be in
any of the denominators you're using. Best way to do this is write
another query with the same from and where clause buy not a select query
- this is air sql here, pasted from your original:

SELECT ActiveBranch.[Branch Name], MonthClosingUni t, YTDClosingUnit,
MonthClosingVo lume
FROM (tblACPLTrialBa lanceHistory INNER JOIN ActiveBranch ON
tblACPLTrialBa lanceHistory.Co stCenter = ActiveBranch.Co stCenter) INNER JOIN
tblGENRClosing Summary ON ActiveBranch.Co stCenter = tblGENRClosingS ummary.
CostCenter
WHERE (((tblACPLTrial BalanceHistory. ActgPeriod) Between [Forms]!
[frmACLSRptsMTDY TD]![MthBegDt] And [Forms]![frmACLSRptsMTDY TD]![MthEndDt])
AND ((tblACPLTrialB alanceHistory.[GLAcct#])="300610" Or
(tblACPLTrialB alanceHistory.[GLAcct#])="300611" Or
(tblACPLTrialB alanceHistory.[GLAcct#])="300802" Or
(tblACPLTrialB alanceHistory.[GLAcct#])="300899" Or
(tblACPLTrialB alanceHistory.[GLAcct#])="300999" Or
(tblACPLTrialB alanceHistory.[GLAcct#])="300902"))

If there ary zeros in the above, this could be causing it.

Other than those two things, nothing else immediately jumps out at me.
You'd then need to trouble shoot it by examining the query structure.

The approach I'd then take is slowly reconstructing the original query
in several ways. For example, starting with just one of the
fields/calulated fields in the select clause running it and seeing if
it's OK, then trying it with another component of the current select
clause by itself and then combining the tested fields and so on. The
same thing could then be done separately or in conjunction with the
previous sentence with items in the where clause - try it without any
where clause, build up one condition at a time.

I'd probably concentrate on doing the "slow build" approach with the
select clause first


--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200604/1
Apr 28 '06 #7
I have now narrrowed it to the 4 -Sum(.... calculations that are causing the
problem, I take one out get the error, take them all out and it works with no
error. so now how to I put the calculation back in and not get the error?

cvollberg wrote:
OK, there is 0's in the numbers so that if probably what is causing the error,
isn't there a statement I can put in front of the equations that will allow
them and not cause the error, what is really funny the report comes out right.
Thanks
Using the -1* did not change the result and we still got the error

[quoted text clipped - 38 lines]
I'd probably concentrate on doing the "slow build" approach with the
select clause first


--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200604/1
Apr 28 '06 #8
cvollberg via AccessMonster.c om wrote:
OK, there is 0's in the numbers so that if probably what is causing the error,
isn't there a statement I can put in front of the equations that will allow them and not cause the error,
You need to decide what information is required if the MonthClosingUni t,
YTDClosingUnit, MonthClosingVol ume, or YTDClosingVolum e is returned as
zero. Knowing nothing about your organization, from the field names, it
seems to me that your fractions are value/number of items sold. I'll
guess that this is right. If so, that would mean that if the number of
units sold in a time period is zero, you would want zero.

If my guess is on the right track, an iif() function could be used to
check if units sold (MonthClosingUn it) is zero, then use zero,
otherwise, use value/units sold (MthEnd/MonthClosingUni t). Model this
for the other fractions. I'll stay away from the -sum because I'm not
familiar with it and assume you want a negative number:

Instead of:

-Sum([MthEnd]/[MonthClosingUni t]) AS [AncillaryFee$MT D]

Use (air code, but hopefully will give you the right idea):

Sum( -1 * (iif([MonthClosingUni t] = 0, 0, ([MthEnd]/[MonthClosingUni t])
) ) ) AS [AncillaryFee$MT D]
what is really funny the report comes out right.


That tells me that the report recordsource is very likely somehow
different from the query you're using.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Apr 28 '06 #9
Your awesome, it worked, thank you so much

Tim Marshall wrote:
OK, there is 0's in the numbers so that if probably what is causing the error,
isn't there a statement I can put in front of the equations that will allow them and not cause the error,


You need to decide what information is required if the MonthClosingUni t,
YTDClosingUnit, MonthClosingVol ume, or YTDClosingVolum e is returned as
zero. Knowing nothing about your organization, from the field names, it
seems to me that your fractions are value/number of items sold. I'll
guess that this is right. If so, that would mean that if the number of
units sold in a time period is zero, you would want zero.

If my guess is on the right track, an iif() function could be used to
check if units sold (MonthClosingUn it) is zero, then use zero,
otherwise, use value/units sold (MthEnd/MonthClosingUni t). Model this
for the other fractions. I'll stay away from the -sum because I'm not
familiar with it and assume you want a negative number:

Instead of:

-Sum([MthEnd]/[MonthClosingUni t]) AS [AncillaryFee$MT D]

Use (air code, but hopefully will give you the right idea):

Sum( -1 * (iif([MonthClosingUni t] = 0, 0, ([MthEnd]/[MonthClosingUni t])
) ) ) AS [AncillaryFee$MT D]
what is really funny the report comes out right.


That tells me that the report recordsource is very likely somehow
different from the query you're using.


--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200604/1
Apr 28 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

39
7889
by: | last post by:
I am trying to run the following agregate function in a parameterized query on Access2000: Min(.*sqr(./.)/) The query saved OK, but an attempt to run it results in the message: The expression is typed incorrectly or it is too complex to be evaluated If the sintax correct? Perhaps it is, otherwise it would not save. What can be done about it?
1
7983
by: Terencetrent | last post by:
I am trying to format a query expression drawn from a dialog box as percent. The original statement to get the value for the query is as follows: New%markup: !! The dialog box looks the values up from a table called NewMarkup. It appears in the dialog box with a percent format. However, when I try to call that value in my query it shows it as a decimal.
3
3303
by: MLH | last post by:
Am repeating question with different subject heading, perhaps stating more clearly my problem... I have an A97 query (qryVehiclesNowners2) that has a table field in it named . Depending on the selections made in a number of criteria choices on a form, a field on the form will have string values in it like... Between #12/1/2004# And #12/31/2004# - or - >= #6/10/2005# - or -
1
3678
by: Andrew | last post by:
How can I create a property or function for a typed datasets column? By this I need to add a new column (element) to the table or override an existing column. For instance I have an Invoice table that needs to have a Status property. This status property has to read the other elements in the table to determine what the status is and return a string. I know that I can enter this in the expression fields, but as the expressions become more...
6
2293
by: Ludwig | last post by:
Hi, i'm using the regular expression \b\w to find the beginning of a word, in my C# application. If the word is 'public', for example, it works. However, if the word is '<public', it does not work: it seems that < is not a valid character, so the beginning of the word starts at theletter 'p' instead of '<'. Because I'm not an expert in regular expressions, maybe someone of you guys can help me? I need the correct regex to find the...
9
2140
by: jessicaeatworld | last post by:
Hi, I'm using Access 2003 on Windows XP. My Error: This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables. I'm guessing that one of these calcs is the problem: (/)*31 AS , (/)*31 AS , (/)*31 AS , / AS
4
1687
by: cmartin1986 | last post by:
I am trying to write a sql query to return a count of records from a user defined supplier in weekly buckets going back from a user defined date. I get an error saying "This expression is typed incorrectly or it is too complex to be evaluated...." When I orginally wrote this it would simply start from Date() and go back weekly and still had a user defined supplier. What i did was add a combo box to my "front" form for a user input date, at...
1
5028
by: Coll | last post by:
I'm receiving this message when running a query... This expression is typed incorrectly or is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables. Here's the background. I have a query. I've figured out through cutting and pasting which field is the culprit. So I have a field with the following info...
2
1323
by: sarahms2201974 | last post by:
Hi, I'm attempting to create a database that holds a simple typing test and I'm having some trouble setting it up. I've created a table that holds 5 test samples. The thought is when someone takes the test they will be given a printout of one of the five samples. They will enter the test sample # in the test form and then complete the test by typing what's on their printout. I need to figure out a way to compare what's typed in a...
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5504
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.