473,378 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

SQL if statement with 3 variables

55
In Access 2000, I'm trying to create a couple reports but can't figure out the queries.

1. In a form, I have a control with a dollar amount, with the source field [Price]. Then there's an option group to indicate if the amount is 1) estimated or 2) firm, with the source field [EstFirmAmt]. On my report, I want to have one control that shows the dollar amount for Estimated Price and another for Firm Price. I thought I could create new fields in the query called PriceEst and PriceFirm. I tried this:

PriceEst: Iif(([EstFirmAmt]=1),[Price],0).

I got #Error. I don't know whether the 0 needs to be "0"... actually, I'd rather it be simply Null. So I don't know how to end that statement correctly. But no matter what I tried, I still got #Error.

So my first question is how to set up this query.

2. I need a report to count over a specified period of time the number of bids requested, submitted, and awarded. The problem is that each of these is related to a different date field in the table. "Bids requested" relates to the date an internal number was assigned to the bid: AssignedDate. "Bids submitted" relates to SubmitDate. "Bids awarded" relates to AwardDate. So I'm trying to create a single report that shows 1) number of records with AssignedDate between, for instance, 1/15/08 and 2/29/08 (dates to be specified by the user running the report), 2) number of records with SubmitDate in the same date range, and 3) number of records with Award Date in the same date range. And finally, I'd like the heading of the report to say "Bid Totals Between 1/15/08 and 2/29/08".

-I've tried creating a query, but I can't figure it out.

-I've tried creating calculated fields in a report based on the table. For instance, for bids submitted, I tried:
=(SELECT Count([Bids Table].ID) AS CountOfID FROM [Bids Table] WHERE ((([Bids Table].[SubmitDate]) Between [What start date?] And [What end date?])))
The report doesn't ask me for "What start date" and "What end date", it shows #Name? in the control, and it appears to show each record separately, rather than one counted total.

-I've also tried creating 3 subreports to stick in one main report with no record source. For this, I end up answering my questions "What start date?" and "What end date?" four times each, and although the subreports work, I get #Name? for the dates in the report header.

So if anyone has an idea for either or both of these reports, I would be grateful!

Angi
Mar 10 '08 #1
0 1373

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

Similar topics

8
by: David Hitillambeau | last post by:
Hi guys, As I am new to Python, i was wondering how to declare and use global variables. Suppose i have the following structure in the same module (same file): def foo: <instructions>...
1
by: Daniel Roy | last post by:
Hi gurus, I just started to look at a very slow-running SQL statement generated by an application (Siebel). I spooled the SQL from the application, replaced the bind variables by their values, and...
5
by: Alvin Bruney | last post by:
Is a switch more efficient than an if statement? I observe thru the debugger that a switch statement jumps directly to its case handler where as an if statement examines all conditions...
7
by: Sunny | last post by:
Hi, I can not understend completely the lock statement. Actally what is locked: 1. the part of the code between {...} or 2. the object in lock() In the docs is written: for 1: The lock...
35
by: Thierry Loiseau | last post by:
Hello all, and Happy end year 2005 ! Well, I would like to obtain a list of all JavaScript var statement, With "for...in" perharps ? That is bellow my recent test here, but the problem is...
13
by: eman1000 | last post by:
I was recently looking at the prototype library (http://prototype.conio.net/) and I noticed the author used the following syntax: Object.extend(MyObj.prototype, { my_meth1: function(){},...
12
by: reycri | last post by:
While the following is allowed: if (a == b) SomeFunction(); else OtherFunction(); The following is not: try
1
by: microsoft.public.dotnet.languages.vb | last post by:
Hi All, I wanted to know whether this is possible to use multiple variables to use in the select case statement such as follows: select case dWarrExpDateMonth, dRetailDateMonth case...
2
by: gool | last post by:
Hi, I am writing this piece of code: $sqlquery="WITH journey (TO_TOWN, STEPS, DISTANCE, WAY) AS (SELECT DISTINCT JNY_FROM_TOWN, 0, 0, CAST('PARIS' AS VARCHAR(MAX)) FROM T_JOURNEY ...
2
by: franc sutherland | last post by:
Hello, I am using Access 2003. Is it possible to use string variables in the INSERT INTO statement? I am using the INSERT INTO statement to add a long list of contacts to a group by looping...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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 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.