473,670 Members | 2,228 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error on query calculation

10 New Member
I am a novice working in Access 2002 trying to run a query I created. I am receiving the error "scaling of decimal value resulted in data trunction", which I have determined is due to this calculation: I.UNITS*Count(T .ENROLLMENTSTAT US)/8 AS DAYS

My query includes 6 joins but it happens with just 1 join or all of them. If I pull this calculation out, it works fine. In design view, I have tried to adjust the decimal property to every possible value from Auto to 7, and nothing seems to work. I still get the error when I run the query with the joins. Here is my query with just 1 of the 6 joins:

SELECT Left(I.LEARNING ACTIVITYCODE,3) AS CATEGORY, I.LEARNINGACTIV ITYTITLE, I.LEARNINGACTIV ITYCODE, I.CODE, I.STARTDATE, I.ENDDATE, I.UNITS, Count(T.ENROLLM ENTSTATUS) AS COMPLETED, I.UNITS*Count(T .ENROLLMENTSTAT US) AS HOURS, I.UNITS*Count(T .ENROLLMENTSTAT US)/8 AS DAYS, T.ENROLLMENTSTA TUSDESCR
FROM LMS650_DRLAINST ANCEFULL AS I, LMS650_DRLATRAN SCRIPTFULL AS T
WHERE (((T.LEARNINGAC TIVITYID)=[i].[LEARNINGACTIVIT YID]) AND ((T.INSTANCECOD E)=[i].[code]) AND ((I.LEARNINGACT IVITYCODE) Like 'ODL%') AND ((I.STARTDATE) Between #9/1/2006# And #9/30/2006#) AND ((I.STATUS)='A' ) AND ((T.ENROLLMENTS TATUS)='C') AND ((T.ENROLLMENTS TATUSDESCR)='Co mpleted'))
GROUP BY I.LEARNINGACTIV ITYTITLE, I.LEARNINGACTIV ITYCODE, I.CODE, I.STARTDATE, I.ENDDATE, I.UNITS, T.ENROLLMENTSTA TUSDESCR, T.ENROLLMENTSTA TUS

UNION ALL SELECT Left(I.LEARNING ACTIVITYCODE,3) AS CATEGORY, I.LEARNINGACTIV ITYTITLE, I.LEARNINGACTIV ITYCODE, I.CODE, I.STARTDATE, I.ENDDATE, I.UNITS, Count(T.ENROLLM ENTSTATUS) AS COMPLETED, I.UNITS*Count(T .ENROLLMENTSTAT US) AS HOURS, I.UNITS*Count(T .ENROLLMENTSTAT US)/8 AS DAYS, T.ENROLLMENTSTA TUSDESCR
FROM LMS650_DRLAINST ANCEFULL AS I, LMS650_DRLATRAN SCRIPTFULL AS T
WHERE (((T.LEARNINGAC TIVITYID)=[i].[LEARNINGACTIVIT YID]) AND ((T.INSTANCECOD E)=[i].[code]) AND ((I.LEARNINGACT IVITYCODE) Like 'ODT%') AND ((I.STARTDATE) Between #9/1/2006# And #9/30/2006#) AND ((I.STATUS)='A' ) AND ((T.ENROLLMENTS TATUS)='C') AND ((T.ENROLLMENTS TATUSDESCR)='Co mpleted'))
GROUP BY I.LEARNINGACTIV ITYTITLE, I.LEARNINGACTIV ITYCODE, I.CODE, I.STARTDATE, I.ENDDATE, I.UNITS, T.ENROLLMENTSTA TUSDESCR, T.ENROLLMENTSTA TUS
ORDER BY I.LEARNINGACTIV ITYCODE, I.CODE, I.LEARNINGACTIV ITYTITLE, I.STARTDATE DESC;

Any help or suggestions would be greatly appreciated. Thank you.
Sep 21 '06 #1
4 1675
MMcCarthy
14,534 Recognized Expert Moderator MVP
Format(I.UNITS* Count(T.ENROLLM ENTSTATUS)/8 AS DAYS, "0000.00")
Sep 21 '06 #2
heckstein
10 New Member
Format(I.UNITS* Count(T.ENROLLM ENTSTATUS)/8 AS DAYS, "0000.00")
Thank you! Do I put it in just like this?

SELECT Left(I.LEARNING ACTIVITYCODE,3) AS CATEGORY, I.LEARNINGACTIV ITYTITLE, I.LEARNINGACTIV ITYCODE, I.CODE, I.STARTDATE, I.ENDDATE, I.UNITS, Count(T.ENROLLM ENTSTATUS) AS COMPLETED, I.UNITS*Count(T .ENROLLMENTSTAT US) AS HOURS, Format(I.UNITS* Count(T.ENROLLM ENTSTATUS)/8 AS DAYS, "0000.00"),
T.ENROLLMENTSTA TUSDESCR

I am now getting a syntex error (missing operator) on that code. Also, can I change the decimal to reflect 3 or 4 numbers after the decimal - like 0000.000?
Thanks again.
Sep 21 '06 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
My apologies I was careless

SELECT Left(I.LEARNING ACTIVITYCODE,3) AS CATEGORY, I.LEARNINGACTIV ITYTITLE, I.LEARNINGACTIV ITYCODE, I.CODE, I.STARTDATE, I.ENDDATE, I.UNITS, Count(T.ENROLLM ENTSTATUS) AS COMPLETED, I.UNITS*Count(T .ENROLLMENTSTAT US) AS HOURS,
Format(I.UNITS* Count(T.ENROLLM ENTSTATUS)/8, "0000.00") AS Days,
T.ENROLLMENTSTA TUSDESCR

Thank you! Do I put it in just like this?

SELECT Left(I.LEARNING ACTIVITYCODE,3) AS CATEGORY, I.LEARNINGACTIV ITYTITLE, I.LEARNINGACTIV ITYCODE, I.CODE, I.STARTDATE, I.ENDDATE, I.UNITS, Count(T.ENROLLM ENTSTATUS) AS COMPLETED, I.UNITS*Count(T .ENROLLMENTSTAT US) AS HOURS, Format(I.UNITS* Count(T.ENROLLM ENTSTATUS)/8 AS DAYS, "0000.00"),
T.ENROLLMENTSTA TUSDESCR

I am now getting a syntex error (missing operator) on that code. Also, can I change the decimal to reflect 3 or 4 numbers after the decimal - like 0000.000?
Thanks again.
Sep 21 '06 #4
heckstein
10 New Member
My apologies I was careless

SELECT Left(I.LEARNING ACTIVITYCODE,3) AS CATEGORY, I.LEARNINGACTIV ITYTITLE, I.LEARNINGACTIV ITYCODE, I.CODE, I.STARTDATE, I.ENDDATE, I.UNITS, Count(T.ENROLLM ENTSTATUS) AS COMPLETED, I.UNITS*Count(T .ENROLLMENTSTAT US) AS HOURS,
Format(I.UNITS* Count(T.ENROLLM ENTSTATUS)/8, "0000.00") AS Days,
T.ENROLLMENTSTA TUSDESCR
No problem and thank you!!!!! It worked and I appreciate it greatly. This forum has been so helpful. As a novice that is forced to learn by trial and error, it is really great to have people like you that are willing to help others. Thanks again.
Sep 21 '06 #5

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

Similar topics

4
4013
by: muser | last post by:
Can anyone run this program through their compiler or if they can see a logical error please point it out. I have my tutor working on it at the moment but I would rather a less ambigious response than the one I think he will provide. The test data, A:\\"514650.txt", appears at the end of the program. The problem is that the program won't read this file and the debugger as far as i know how to work it won't point out the mistake of any....
2
4729
by: Steve | last post by:
An Access97 database I wrote contains a dynamic query whose results get exported to Excel. I have WindowsXP and Access97, 2000 and XP installed. When I run the query, it runs trouble free. A customer with Windows98 and Access97 on three different machines runs the query on any of the three and gets error 3190 Too Many Fields Defined. To run the dynamic query, fields for the query are picked from multi-select listboxes. If one selected every...
4
2065
by: d.p. | last post by:
Hi all, I'm using MS Access 2003. Bare with me on this description....here's the situation: Imagine insurance, and working out premiums for different insured properties. The rates for calculating premiums are dependant on the country in which the client is in. Therefore, we have a Country table, with its list of rates, a client table and then the property table. Getting this is great, works fine, easy! Problem is, now I need to work out a...
0
1860
by: leavandor | last post by:
I am trying to design a query that works with a relationship between a Table and a Query. I am comparing a value in the table with a computed value inside the query. The reason for this is that the Query calculates a field to become identical to the corresponding table field, for instance: Table 1 contains field "ID", which is WV008A00 Table 2 contains field "ID In", which is WV001000
1
1629
by: Andrew Chanter | last post by:
I have an application that produces examination scores. Candidates have a choice of sitting 1 of 2 subjects or both. I have produced a query that gives all the results for candidates that sat subject A. This contains some fairly complex calculations. My problem is that I need to produce a report that shows the scores for all candidates regardless of whether they sat the exam for subject A. This should be fairly easy to produce: simply...
3
6505
by: martlaco1 | last post by:
Trying to fix a query that (I thought) had worked once upon a time, and I keep getting a Data Type Mismatch error whenever I enter any criteria for an expression using a Mid function. Without the criteria, the Mid function returns the values when I run the query. So if one of the values is a "t" (no quotes), can I not ask to isolate that record by putting "t" as a criteria? Nope - error, error. If I put it within the expression itself...
5
9421
by: jonm4102 | last post by:
I'm trying to calculate the median of some numerical data. The data can only be found in a query (henceforth query 1) field I previously made, and I would prefer to calculate the median in a new query it without making a table out of query 1. I can't find a median function in the "Total" field, so is there so way to make an expression to calculate the median of the orignial data from query 1 in my new query? Also, what does name by...
4
3757
by: vg-mail | last post by:
Hello all, I have identical design for form and report but I am getting calculation error on form and everything is OK on report. The form and report are build up on SQL statement. The calculation is very simple. The calculation is done in an underling query if I can call it a query or I should call it a SQL statement. It looks like a query but it is not saved as the query. The calculation in that query is very simple - ExtendedPrice:*....
3
1596
by: oopsatwork | last post by:
I'm trying to construct an XPath and it is giving me trouble. I have an XML that contains a "Routine". The routine contains "Steps". The steps have different types. Some types of steps have more steps contained within them (substeps). I want to get a list of all of the steps in a routine, including any substeps...but excluding substeps that occur in a particular type of step ("Subroutine"). Below is a simplified example XML. The...
0
8469
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
8903
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...
0
8814
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8592
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,...
0
7419
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6213
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
4211
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2800
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
2
2042
muto222
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.