DataBase - Cannot determine casue of overflow error
Asked By AccessNewbieNic
30-Jan-09 11:13 AM

The SQL is as follows,
SELECT DISTINCT [PO Works Order].[PO Works Order ID], [PO Works Order].[PO
Item ID], [PO Works Order].[Works Order Number], [divide cost].[Additional
info], [divide cost].Prefix, [divide cost].[Item Number], [divide
cost].[Order Type], [divide cost].[Parts quant],
IIf(IsNull([SumOfQuantity]),[Quantity of items ordered],IIf([Quantity of
items ordered]=[Quantity],[SumOfQuantity],[Quantity of items ordered])) AS
[Num of Parts], ([Quant]/[Parts Quant])*IIf(IsNull([sub incoming
invoice].[Price Each]),([divide cost].[Price Each]+[Material Surcharge per
kg]*[Weight (kg)]),[sub incoming invoice].[Price Each]+[Material surcharge
each]) AS Portion
FROM (([PO Works Order] INNER JOIN [divide cost] ON [PO Works Order].[PO
Item ID] = [divide cost].[Item ID]) LEFT JOIN [sub incoming invoice] ON
[divide cost].[Item ID] = [sub incoming invoice].[Item Number]) LEFT JOIN
[total invoiced] ON [divide cost].[Item ID] = [total invoiced].[Item ID];
When trying to run the query an 'Overflow' error occurs, and the field
creating the problem (by process of elimination) is a calculation. Namely-
Portion: ([Quant]/[Parts Quant])*IIf(IsNull([sub incoming invoice].[Price
Each]),([divide cost].[Price Each]+[Material Surcharge per kg]*[Weight
(kg)]),[sub incoming invoice].[Price Each]+[Material surcharge each])
All fields have a Long integer or Currency format and the [Portion] output
field has a currency format. The calculation has always worked previously
which seems to indicate that some recently entered data has caused the
problem.
So is there a max field size for currency? Largest amount is likely to be
£20,000.00
Or can anyone spot a mistake or have an idea of this issue?
Thank you in advance for any help
SumOfQuantity
(1)
Vanderghast
(1)
Quant
(1)
Casue
(1)
£20
(1)
Max
(1)
Michel Walsh replied...
Probably because Parts Quant is zero for at least one record. Indeed, you
divide by it:
([Quant]/[Parts Quant])
Dividing by zero is not allow, mathematically, unless you want to deal with
infinities.
Vanderghast, Access MVP

you could preferably use the pre-defined rank operator (Jet does not have such operator). Vanderghast, Access MVP Hi, Interesting solution. I will have to look at it some more to can be in many simultaneous games, like a chess master player playing simultaneous chess games. Vanderghast, Access MVP l p gic 't 1aa817b9720f@uwe. . . totally ee or there ed a de the proposed query should return what you want (the highest winning-streak for each player). Vanderghast, Access MVP ree or more n a e ID r and one I = 3D B null neither 0, but the result of a comparison is -1: ? int(3 = 3) -1 Vanderghast, Access MVP Ok. that gives a result of -1 for the winners and 0 for part. And yes, it takes time, unfortunately Jet has not implemented, yet, any RANK operator. Vanderghast, Access MVP = A0isWin at he ANK s om. . . If to rd = A0isWin nd at d against himself!). You will have to change the SQL statements to replace [Date] by GameID. Vanderghast, Access MVP It is preferable to have date as date_time datatype rather than string. If no need for GameID to be continuous, without holes in the sequence of values, though. Vanderghast, Access MVP f game id is autonumbered so every time i enter a result, a the first solution (modifying the second query) is hardly what I call 'self documented' either. Vanderghast, Access MVP You were probably using string rather than date_time as DATA TYPE for that
Access Queries Discussions TransactionID (1) TransactionDate (1) TableNameHere (1) TransactionAmount (1) AccountNumber (1) CheckNumber (1) Vanderghast (1) TableName (1) Assuming there is a single transaction, per second, per account. Assuming there fields name were account, dateTime (for the date and time of the transaction) and amount. Vanderghast, Access MVP My field names are Check Amount and Deposit Amount. Where would I put a.accountNumber = b.accountNumber AND a.dateTime > = b.dateTime GROUP BY a.accountNumber, a.dateTime Vanderghast, Access MVP This is a very simple account. For date it is set to edium could have done, graphically, to produce that query (rather than doing it in SQL view). Vanderghast, Access MVP Ok, this seems like it will work, as it runs, but does not a.[Check Name]) AS purpose, SUM(b.[Deposit Amount] - b.[Check Amount]) As running FROM . . . Vanderghast, Access MVP I am sorry. Is there something missing, I tired to follow from the Can you post part of the initial data you have in your initial table, here? Vanderghast, Access MVP or, if you want to keep the graphical editor: SELECT a.[date of WHERE a.[date of transaction] > = b.[date of transaction] GROUP BY a.[date of transaction] Vanderghast, Access MVP Ok, when I change the data so that all have a unique date of the running sum) will be properly defined, and the first sum will become correct. Vanderghast, Access MVP Here's an alternative approach, which uses subqueries to compute the balance. This
supplies the name: str = ". . . FROM [" & suppliedTableName & "] . . . " (Assuming such practice is acceptable in the first place). Vanderghast, Access MVP Rick Brandt <rickbrandt2@hotmail.com> wrote in I have never bothered to figure 1.045 AS PST, price +TPS + PST AS totalPrice FROM somewhere Other mundane details, too. Vanderghast, Access MVP Interesting. All of my attempts to use that syntax in Jet had failed Jet is more intuitive, wrong (by the SQL standard), but acceptable . . . by many (kind of) Vanderghast, Access MVP Ah, the parentheses are the key! - - HTH, Bob Barrows [] Uh, you're quoting if the condition was implying the unpreserved table, but it is not the case, here. Vanderghast, Access MVP I didn't intend to say it was: at the time I made no record, while MS SQL Server returns as many records as there is in Orders. Vanderghast, Access MVP Yes, MS SQL Server does it accordingly to the ANSI specs, while JET to be aware of the *possible* difference in result, even if no 'parsing' error occurs! Vanderghast, Access MVP Quick recap: We were discussing why it would be better to put JOIN if the condition implying just one table is the preserved table of the outer join. Vanderghast, Access MVP Er, what? Shorter only matters if you're hand-coding your SQL. The large part 'just for the show', but sometimes, it just relaxing to see such things. Vanderghast, Access MVP keywords: Better, "Join", vs, "Where", clause? description: 2003, 2007 At the EOD, it
where" DataBase Bonjour, je cale sur un petit bout de vba le r = E9sultat attendu ("Quant") : compter le nombre de valeurs = E9gales = E0 une valeur s = E9lectionn = E9e ("Risquec") dans le Forms]![produits_saisie]!id Dim Risquec As String Risquec = 3D [Forms]![produits_saisie]!liste_choix.Column(0) Dim Quant As Integer Quant = 3D DCount("[code_risque]", "codes_risk_cons", _ [codes_risk_cons].[code_risque] = 3D Risquec") Merci d'avance pour votre aide compatibilit = E9s, je cite = E7a de m = E9moire. Bonjour, spectre a ?crit : Essaye avec ceci : . . . Quant = DCount("[code_risque]", "codes_risk_cons", _ Bonjour, Si j'ai bon souvenir, dans les fonctions domaine, il s9g2000vby.googlegroups.com. . . Bonjour, je cale sur un petit bout de vba le résultat attendu ("Quant") : compter le nombre de valeurs égales à une valeur sélectionnée ("Risquec") dans le champs "code_risque code_id = [Forms]![produits_saisie]!id Dim Risquec As String Risquec = [Forms]![produits_saisie]!liste_choix.Column(0) Dim Quant As Integer Quant = DCount("[code_risque]", "codes_risk_cons", _ [codes_risk_cons].[code_risque] = Risquec") Merci d'avance pour votre aide. . . Bye Bonsoir where" description: Bonjour, je cale sur un petit bout de vba le r = E9sultat attendu (Quant) : compter le nombre de valeurs = E9gales = E0 une valeur s = E9lectionn = E9e (Risquec
www.accessmonster.com / Uwe / Forums.aspx / access-queries / 200903 / 1 Access Queries Discussions SumOfSumOfQuantity (1) SumOfQuantity (1) Report (1) Wayfarer (1) Rearange (1) Repairs (1) Try this - - SELECT Count(gamrep.[Serial found the solution to the grouping problem as shown below, TRANSFORM Sum([Wayfarer Weekly Output].SumOfQuantity) AS SumOfSumOfQuantity SELECT [Wayfarer Weekly Output].[Part #], [Wayfarer Weekly Output]. Description, Count([Wayfarer Weekly Output].SumOfQuantity) AS [Total Of SumOfQuantity] FROM [Wayfarer Weekly Output] GROUP BY [Wayfarer Weekly Output].[Part #], [Wayfarer Weekly Output]. Description PIVOT