I am putting together a database with the fields:
1. Number of Projects
2. Project (Name)
3. Project Contact
4. Company
5. Location (City, State)
6. Last Contact Date
7. Mw/g
8. Project Type
9. Total Project Capital
10. Expected Final Close (Date)
11. Financing Type (this will be either 1, 2, 3, or 4)
12. Score
13. Loan Amount (this amount will vary)
I would like to run a query that would add a column called the TRV Capital. I would like TRV Capital to calculate "11. Financing Type (this will be either 1, 2, 3, or 4)" and "13. Loan Amount (this amount will vary)" under a few circumstances.
The circumstances would be:
If "Financing Type" = 1 or 2 THEN the TRV Capital would be 20% * "Loan Amount" OR If "Financing Type" = 3 or 4 THEN the TRV Capital would be 100% * "Loan Amount"
I tried putting in the espression as:
TRV Capital: IIf([Financing Type]="1",[Loan Amount]*0.2,IIf([Financing Type]="2",[Loan Amount]*0.2,IIf([Financing Type]="3",[Loan Amount]*1,IIf([Financing Type]="4",[Loan Amount]*1))))
But it is not working. Please HELP!!!!!
9 1489
Is financing type a number or text? Because with the quotes, you're telling Access that it's text.
Financing Type is a number. Ok. I took away the quotes. But I still get this error message that says," You tried to execute a query that does not include specified expression IIf([TRV Main Pipeline].[Financing Type]=1,[Loan Amount]*0.2,IIf([Financing Type]=2,[Loan Amount]*0.2,IIf([Financing Type]=3,[Loan Amount]*1,IIf([Financing Type]=4,[Loan Amount]*1)))) as part of an aggregate function."
What does that mean?
Then you need to get rid of the quotes.
Ok. I took away the quotes. But I still get this error message that says," You tried to execute a query that does not include specified expression IIf([TRV Main Pipeline].[Financing Type]=1,[Loan Amount]*0.2,IIf([Financing Type]=2,[Loan Amount]*0.2,IIf([Financing Type]=3,[Loan Amount]*1,IIf([Financing Type]=4,[Loan Amount]*1)))) as part of an aggregate function."
What does that mean?
Then you need to get rid of the quotes.
Ok. I took away the quotes. But I still get this error message that says," You tried to execute a query that does not include specified expression IIf([TRV Main Pipeline].[Financing Type]=1,[Loan Amount]*0.2,IIf([Financing Type]=2,[Loan Amount]*0.2,IIf([Financing Type]=3,[Loan Amount]*1,IIf([Financing Type]=4,[Loan Amount]*1)))) as part of an aggregate function."
What does that mean?
It means you're using a totals query but you're not using that field as part of the calculation. What's the whole SQL string? What is the query supposed to do?
SQL String is:
SELECT DISTINCTROW [TRV Main Pipeline].Project, [TRV Main Pipeline].[Project Contact], [TRV Main Pipeline].Company, [TRV Main Pipeline].[Location (City, State)], [TRV Main Pipeline].[Last Contact Date], [TRV Main Pipeline].[Mw/g], [TRV Main Pipeline].[Project Type], [TRV Main Pipeline].[Expected Final Close], [TRV Main Pipeline].[Financing Type], [TRV Main Pipeline].[TRV Person (Initials)], Sum([TRV Main Pipeline].[Number of Projects]) AS [Sum Of Number of Projects], Sum([TRV Main Pipeline].[Total Project Capital]) AS [Sum Of Total Project Capital], Sum([TRV Main Pipeline].[Loan Amount]) AS [Sum Of Loan Amount], Count(*) AS [Count Of TRV Main Pipeline], [TRV Main Pipeline].Score, IIf([TRV Main Pipeline].[Financing Type]=1,[Loan Amount]*0.2,IIf([Financing Type]=2,[Loan Amount]*0.2,IIf([Financing Type]=3,[Loan Amount]*1,IIf([Financing Type]=4,[Loan Amount]*1)))) AS [TRV Capital]
FROM [TRV Main Pipeline]
GROUP BY [TRV Main Pipeline].Project, [TRV Main Pipeline].[Project Contact], [TRV Main Pipeline].Company, [TRV Main Pipeline].[Location (City, State)], [TRV Main Pipeline].[Last Contact Date], [TRV Main Pipeline].[Mw/g], [TRV Main Pipeline].[Project Type], [TRV Main Pipeline].[Expected Final Close], [TRV Main Pipeline].[Financing Type], [TRV Main Pipeline].[TRV Person (Initials)], [TRV Main Pipeline].Score;
I would like the TRV Capital to calculate that If "Financing Type" = 1 or 2 THEN the TRV Capital would be 20% * "Loan Amount" OR If "Financing Type" = 3 or 4 THEN the TRV Capital would be 100% * "Loan Amount"
It means you're using a totals query but you're not using that field as part of the calculation. What's the whole SQL string? What is the query supposed to do?
I would like the TRV Capital to calculate that If "Financing Type" = 1 or 2 THEN the TRV Capital would be 20% * "Loan Amount" OR If "Financing Type" = 3 or 4 THEN the TRV Capital would be 100% * "Loan Amount"
That's only one of the things you want to do. What do you want the query to do?
That is all I want the query to do. As I input the Financial Type and the Loan Amount, I need the TRV Capital to take what I input and give me the calculated amount. I would like the actual table to do it, but I don't think it would, so I chose to try in query form.
TRV Capital: IIf([Financing Type]=1,[Loan Amount]*0.2,IIf([Financing Type]=2,[Loan Amount]*0.2,IIf([Financing Type]=3,[Loan Amount]*1,IIf([Financing Type]=4,[Loan Amount]*1)))) (??)
That's only one of the things you want to do. What do you want the query to do?
That is all I want the query to do. As I input the Financial Type and the Loan Amount, I need the TRV Capital to take what I input and give me the calculated amount. I would like the actual table to do it, but I don't think it would, so I chose to try in query form.
TRV Capital: IIf([Financing Type]=1,[Loan Amount]*0.2,IIf([Financing Type]=2,[Loan Amount]*0.2,IIf([Financing Type]=3,[Loan Amount]*1,IIf([Financing Type]=4,[Loan Amount]*1)))) (??)
Well, you have all these SUM functions in there. Get rid of those and get rid of the entire GROUP BY statement.
If all you need is the TRV Capital then you don't need the SUMs and the GROUP BY.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Sims |
last post by:
Hi,
I need some help to split data using regular expression
Consider the string
'1,2,3', I can split it using, preg_split("/,/", '1,2,3') and i correctly
get =1, =2,=3.
Now if i have
|
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...
|
by: Gálos Zsuzsa |
last post by:
Hi all,
I need to calculate Formulas.
For example:
dim strFormula as string="25*(12-6)"
I ned a DotNet Function to calculate this Formula (25*(12-6)=150):
dim dblValue as double = 150
|
by: talin at acm dot org |
last post by:
I've been reading about how "lambda" is going away in Python 3000 (or
at least, that's the stated intent), and while I agree for the most
part with the reasoning, at the same time I'd be sad to see...
|
by: frankh |
last post by:
Got earlier very valuable feedback from this group, so I am trying
again.
Given a string with an arithmetic expression containing variables, e.g.
"a+b*sin(x)", how can I calculate its value...
|
by: Klaus Jensen |
last post by:
Hi!
I am currently converting an ASP/SQL Server application to VB.Net/Access.
The application performs calculations based on which products are selected.
Therefore i need to be able to store...
|
by: sarathy |
last post by:
Hi,
Can anyone just help me with what exactly is constant
expression. I read the section on Constant expression in K&R2. i am not
fully clear with it.
|
by: Carles Company Soler |
last post by:
Hello,
I want to calculate the value of an attribute. For example <rect x="2+3"
y="12"and be <rect x="5" y="12">. Is it possible using XSLT?
Thanks!
|
by: Libber39 |
last post by:
Hi everyone,
Have a query on how to calculate the amount of weeks and days contained in a number in an access query. ie: the difference in days between 2 dates amounts to 17 days. I want to now...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: 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...
|
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,...
| |