I've tried this string to Sum up payments, moving brackets and paren's different ways, I still get error 'type mismatch'....not sure why. Can anyone point me in the right direction?? thanks - LineTotal: Sum(CLng([Quantity]*[UnitPrice]*(1-[Discount])*100)/100)
Rosie
17 5013
I've tried this string to Sum up payments, moving brackets and paren's different ways, I still get error 'type mismatch'....not sure why. Can anyone point me in the right direction?? thanks - LineTotal: Sum(CLng([Quantity]*[UnitPrice]*(1-[Discount])*100)/100)
Rosie
My guess would be that it has to do with the CLng. Have you tried doing the Sum without it?
Maybe try it this way:
CLng(Sum(([Quantity]*[UnitPrice]*(1-[Discount])*100)/100))
I've tried this string to Sum up payments, moving brackets and paren's different ways, I still get error 'type mismatch'....not sure why. Can anyone point me in the right direction?? thanks - LineTotal: Sum(CLng([Quantity]*[UnitPrice]*(1-[Discount])*100)/100)
Rosie
What is a reason for using CLng function.
BTW [Quantity]*[UnitPrice]*(1-[Discount]) will be negative when [Discount]>1
BTW [Quantity]*[UnitPrice]*(1-[Discount]) will be negative when [Discount]>1
My guess is that [Discount] is a percentage in decimal form so it probably won't ever be greater than 1. But I can't speak for imrosie, so I could be wrong
My guess would be that it has to do with the CLng. Have you tried doing the Sum without it?
Maybe try it this way:
CLng(Sum(([Quantity]*[UnitPrice]*(1-[Discount])*100)/100))
Mlcampeau,
No I will give that a try though,,,thanks
Rosie
What is a reason for using CLng function.
BTW [Quantity]*[UnitPrice]*(1-[Discount]) will be negative when [Discount]>1
FishVal,
No particular reason for it,,,I saw it in a book and it looked like could work for what I was trying to do. the [Discount] is for 'less than' 1 not greater than. you're right in that case, it would be negative.
Rosie
My guess is that [Discount] is a percentage in decimal form so it probably won't ever be greater than 1. But I can't speak for imrosie, so I could be wrong
MLcampeau,
You're so right, the [Discount] is a percentage in decimal form, it will never be greater than 1. thanks for your input. However, I just tried your suggestion, but it didn't work...
(Maybe try it this way): - CLng(Sum(([Quantity]*[UnitPrice]*(1-[Discount])*100)/100))
thanks anyway
Rosie
MLcampeau,
You're so right, the [Discount] is a percentage in decimal form, it will never be greater than 1. thanks for your input. However, I just tried your suggestion, but it didn't work...
(Maybe try it this way): - CLng(Sum(([Quantity]*[UnitPrice]*(1-[Discount])*100)/100))
there's no need for the extra set of paren's ....thank but it's the 'clng' it's really complaining about.
thanks anyway
Rosie
there's no need for the extra set of paren's ....thank but it's the 'clng' it's really complaining about.
thanks anyway
there's no need for the extra set of paren's ....thank but it's the 'clng' it's really complaining about.
thanks anyway
oops, didn't mean to put extra paren's in there. I was just suggesting trying to use the CLng outside of the Sum function. Have you tried summing without CLng? - Sum(([Quantity]*[UnitPrice]*(1-[Discount])*100)/100)
oops, didn't mean to put extra paren's in there. I was just suggesting trying to use the CLng outside of the Sum function. Have you tried summing without CLng? - Sum(([Quantity]*[UnitPrice]*(1-[Discount])*100)/100)
Hi MLcampeau,,,,
Even with the extra paren's removed, it doesn't work, it's still complains about a type mixmatch. I think that I've got to look at the tables and figure out why summing
quantity, unit price and discount is a problem
UnitPrice = Currency
Quantity = Number
Discount = Number
Could this be the problem? thanks
Rosie
Sorry, but you still didn't answer whether you tried summing without using CLng.
are [quantity], [unit price], and [discount] in the same table?
I just made a sample table with fields Quanity: Number, UnitPrice: Currency, Discount:Number and tried - Sum(([Quantity]*[UnitPrice]*(1-[Discount])*100)/100)
and that worked for me. So did - Sum(CLng([Quantity]*[UnitPrice]*(1-[Discount])*100)/100)
so I'm not too sure why it won't work for you.
I just made a sample table with fields Quanity: Number, UnitPrice: Currency, Discount:Number and tried - Sum(([Quantity]*[UnitPrice]*(1-[Discount])*100)/100)
and that worked for me. So did - Sum(CLng([Quantity]*[UnitPrice]*(1-[Discount])*100)/100)
so I'm not too sure why it won't work for you.
Wow that's amazing....its in a query, one of the columns, so would that make a difference?
yes, I tried summing without the 'clng' and yes, all those variables are in the same table. That table (order details) is one of the tables in the query which has this 'sum' expression.
Rosie
Wow that's amazing....its in a query, one of the columns, so would that make a difference?
Rosie
Are you saying that you're putting the expression in the query? Because rereading my post I wasn't very clear. I made a table with those three fields, then I created a query with the expression. Are your three fields in one table?
Are you saying that you're putting the expression in the query? Because rereading my post I wasn't very clear. I made a table with those three fields, then I created a query with the expression. Are your three fields in one table?
Yes, the three fields are in the same table (that table is "OrderDetails" which is a part of the 'Receivables Aging query. There are 3 tables along with query called "Sum of Payments, in this whole Receivables Aging query.
thanks
Rosie
Yes, the three fields are in the same table (that table is "OrderDetails" which is a part of the 'Receivables Aging query. There are 3 tables along with query called "Sum of Payments, in this whole Receivables Aging query.
thanks
Rosie
Try specifying which table the fields belong to:
LineTotal: Sum(CLng([OrderDetails].[Quantity]*[OrderDetails].[UnitPrice]*(1-[OrderDetails].[Discount])*100)/100)
Try specifying which table the fields belong to:
LineTotal: Sum(CLng([OrderDetails].[Quantity]*[OrderDetails].[UnitPrice]*(1-[OrderDetails].[Discount])*100)/100)
MLCampeau,
I appreciate your sticking with me on this....I'm going off to try that now...will get back with the results..
Rosie
Sign in to post your reply or Sign up for a free account.
Similar topics
by: dmgauntt2002 |
last post by:
I have some javascript ASP code that sets the expiry date on a cookie
to five years from now. The code worked until today, when I got the
following error message:
Microsoft JScript runtime...
|
by: eminemence |
last post by:
Hi,
I have been trying to get STLPort work for Symbian.
I am using CodeWarrior compiler and it spews this errors namely
*************************************************************************...
|
by: bob95226 |
last post by:
Hi All,
I wrote a VB.NET control in Visual Studio 2003 IDE, I am trying to
re-compile it with command line compiler vbc.exe like this:
vbc /t:library /out:my_control.dll my_control.vb
However...
|
by: ApexData |
last post by:
Access2k
I WAS getting the following error when using the MID function:
Run Time Error '13' Type Mismatch
I have a new single form, unbound with 1-button on it that uses the
following code:...
|
by: Davros9 |
last post by:
Trying to get Regular Expressions working.......
----------------
Public Function SepString(InField As String) As String
''seperates on space and comma
Dim RE As New RegExp
Dim Matches As...
|
by: subashini Thiyagarajan |
last post by:
Any one can help me in this error
Error Type:
Provider (0x80040E21)
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done....
|
by: dstorms |
last post by:
Hi,
I'm trying to create a button on a form that:
1. Takes the ComputerID from the form linked to Table 1,
2. Checks Table 2 for a matching ComputerID, and
3. Opens the query qryEditData, and...
|
by: martin DH |
last post by:
I would definitely appreciate any help with this problem as soon as possible. Thanks!
I have a report that should display the results of a query based on two tables (tblClient and tblResult,...
|
by: DonRayner |
last post by:
This one has me stumped. I'm getting a "Type Mismatch" error on one of my forms when it's being opened. It's hapening before the forms "On Open" event, I stuck a msgbox in there to check and I'm...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
| |