473,473 Members | 1,488 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

strange sql error msg

n8kindt
221 New Member
here's my sql code:

Expand|Select|Wrap|Line Numbers
  1. SELECT ActivityLog.DateSignedIN, Sum(ActivityLog.ProductPurchased) AS SumOfProductPurchased, Sum(ActivityLog.ProductAdj) AS SumOfProductAdj, Sum(ActivityLog.TaxPercent) AS SumOfTaxPercent, Sum(ActivityLog.Subtotal) AS SumOfSubtotal, Sum(ActivityLog.GrandTotal) AS SumOfGrandTotal, Sum(ActivityLog.TransactionType) AS SumOfTransactionType, Sum(Round((((([ProductPurchased] + Nz([ProductAdj],0))*([TaxPercent]*2)) + (([Subtotal]-([ProductPurchased] + Nz([ProductAdj],0)))*[TaxPercent]) + [Subtotal])+Nz([Shipping],0))+0.000001,2)) AS ExpectedGrandTotal, Sum(Round(Nz([GrandTotal],[ExpectedGrandTotal]),2)) AS FinalGT, Sum(ActivityLog.Shipping) AS SumOfShipping, Sum(Round((([TaxPercent]*([Subtotal] - ([ProductPurchased] + Nz([ProductAdj],0)))) + (2*([ProductPurchased] + Nz([ProductAdj],0))*[TaxPercent]) + 0.00000001),2)) AS ExpectedTax, Sum(ActivityLog.ActualTax) AS SumOfActualTax, Sum(Round(Nz([ActualTax],[ExpectedTax]),2)) AS FinalTax, Sum([subtotal]-[productpurchased]) AS Supplies
  2. FROM ActivityLog
  3. WHERE (((Month([DateSignedIN]))=[Forms]![frmDRInput]![Month]) AND ((Year([DateSignedIN]))=[Forms]![frmDRInput]![Year]))
  4. GROUP BY ActivityLog.DateSignedIN;
Here's the error msg:
Subqueries cannot be used in the expression (Round(Nz([GrandTotal],[ExpectedGrandTotal]),2)).

if i hide the 'FinalGT' and the 'ExpectedTax' columns (FinalGT is the one with the troublesome code--i have to hide ExpectedTax, too b/c it returns a similar error msg), it runs fine.... which is wierd b/c 'ExpectedGT' and 'FinalGT' use the same format but they run fine... uhhhh why am i getting this error msg???
May 9 '08 #1
2 1119
nico5038
3,080 Recognized Expert Specialist
I'm afraid you can't use the "as" fields in the same query. You would have to replace them by the calculation used to create them.
An alternative is to save the query without this field and use the saved query in a new query where you place the calculation.

Nic;o)
May 9 '08 #2
n8kindt
221 New Member
I'm afraid you can't use the "as" fields in the same query. You would have to replace them by the calculation used to create them.
An alternative is to save the query without this field and use the saved query in a new query where you place the calculation.

Nic;o)
that makes sense. thanks nico!
May 9 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Olaf | last post by:
I have a frameset page witch contains the myFuc() function. The function is accessed from a page in one of the frames in the frameset. An example is shown below. <input...
25
by: Neil Ginsberg | last post by:
I have a strange situation with my Access 2000 database. I have code in the database which has worked fine for years, and now all of a sudden doesn't work fine on one or two of my client's...
0
by: Kris Vanherck | last post by:
yesterday i started getting this strange error when i try to run my asp.net project: Compiler Error Message: CS0006: Metadata file 'c:\winnt\microsoft.net\framework\v1.1.4322\temporary asp.net...
6
by: Gary | last post by:
I have an application that has been working just fine for a couple of years. It queries a SQL database and returns some formatted data back to the client. I have a new client, who has a larger...
5
by: Nathan Sokalski | last post by:
When I view my index.aspx page any time after the first time, I recieve the following error: System.Web.TraceContext.AddNewControl(String id, String parentId, String type, Int32 viewStateSize)...
0
by: ivb | last post by:
Hi all, I am using DB2 8.1.11.1 on NT with ASP.NET 1.1 When application make connection to database (via ADO.NET), it set "Connection timeout" parameter to 30 seconds. After, when my webpage...
11
by: Martin Joergensen | last post by:
Hi, I've encountered a really, *really*, REALLY strange error :-) I have a for-loop and after 8 runs I get strange results...... I mean: A really strange result.... I'm calculating...
1
by: JoReiners | last post by:
Hello, I have a really strange problem. I'm unable to figure it out on my own. I parse very simple xml documents, without any check for their form. These files look very similar and are encoded...
11
by: Mike C# | last post by:
Hi all, I keep getting a strange error and can't pin it down. The message is: This application has requested the Runtime to terminate it in an unusual way. Please contact the application's...
3
by: Shelly | last post by:
I am encountering two strange problems. First one: I get a "server misconfiguration error", but only sometimes. It occurs on the first screen that accesses the database on a submit. This error...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.