Using NZ Incorrectly?

Feb 14, 2008

I have a query

SELECT Sum(TBL_MeasuresInstalled.FundingValue) AS ATP_Value
FROM TBL_MeasuresInstalled
GROUP BY TBL_MeasuresInstalled.IDSubmission, TBL_MeasuresInstalled.PriorityBasis
HAVING (((TBL_MeasuresInstalled.IDSubmission)=[Forms]![FRM_SubmissionReport]![cboSubmission]) AND ((TBL_MeasuresInstalled.PriorityBasis)="ATP"));

and it returns nothing when there are no records that match the HAVING clause - I want it to return 0 instead

I have searched the forum and people having similar issues have been advised to use the NZ function so I tried

SELECT NZ(Sum(TBL_MeasuresInstalled.FundingValue) ) AS ATP_Value
FROM TBL_MeasuresInstalled
GROUP BY TBL_MeasuresInstalled.IDSubmission, TBL_MeasuresInstalled.PriorityBasis
HAVING (((TBL_MeasuresInstalled.IDSubmission)=[Forms]![FRM_SubmissionReport]![cboSubmission]) AND ((TBL_MeasuresInstalled.PriorityBasis)="ATP"));

and

SELECT NZ(Sum(TBL_MeasuresInstalled.FundingValue) , 0) AS ATP_Value
FROM TBL_MeasuresInstalled
GROUP BY TBL_MeasuresInstalled.IDSubmission, TBL_MeasuresInstalled.PriorityBasis
HAVING (((TBL_MeasuresInstalled.IDSubmission)=[Forms]![FRM_SubmissionReport]![cboSubmission]) AND ((TBL_MeasuresInstalled.PriorityBasis)="ATP"));


but I get the same result (nothing returned)

View Replies


ADVERTISEMENT

IIF Evaluates Incorrectly?

Oct 3, 2006

I have been staring at this for hours. If anyone can see what I have done wrong I would be so grateful.

In query Q_CTPayDeadline_1
Record ID_Tasks = 194
Field [Stage1B] SHOULD (I believe) evaluate to date 2010-01-01, not 2004-03-31, the former being greater than the latter.

The criteria for field Stage1B is
Stage1B: IIF([NzCease]>[PriorEnd],[NzCease],[PriorEnd])
The values of NzCease and PriorEnd are displayed to the right of Stage1B, for quick reference.
As you can see, for recird ID_Tasks = 194, the values shown are
NzCease = 2010-01-01
PriorEnd = 2004-03-31
BUT
Stage1B = 2004-03-31
ie it treats the IIF() function as returning false, when it should be true.

View 3 Replies View Related

Sum Function Adding Incorrectly?

Mar 15, 2006

Hello,
I'm trying to sum values in a table and the result I'm getting is incorrect.

I have a simple table called Test with one row called Number which is Double. I have 4 values in Number field. They are:
-60000
26.6
2661
62849

When I run a query to sum those fields:
SELECT Sum(Number) As Sum FROM Test;
I get the following result:
5536.60000000001

Interestingly if I change the last number in my table from 62849 to 62848 I get this result:
5535.6

The problem seems to be with summing positive and negative numbers together. In my case, if the sum of positive numbers goes over 65535, the resulting sum is incorrect (adding 0.00000000001 to the result).


Does anybody know why this is happening and if there is a way around this? The actual tables that I work with have a large numbers that go well over 65K so this is a problem for me. I couldn't find anything on google about this.

View 2 Replies View Related

This Expression Is Typed Incorrectly, Or Is Too Complex To Be Evaluated

Aug 16, 2006

Hey guys,

I am getting this error "This expression is typed incorrectly, or is too complex to be evaluated"

For this query:
SELECT first([TblProp].[Name]) AS [SName], First([TblProp].[CommentDate]) AS DateCommented, First([TblProp].[No]) AS BNum, First([TblProp].[Indication]) AS Ind, First([TblProp].[PropSubmitted]) AS DateSub, First([TblProp].[Contact]) AS PrimCon, First([TblProp].[Prepared]) AS PrepName, First([TblProp].[Comment]) AS Comment,First([TblProp].[Value]) AS ValueNew, First([TblProp].[Rating]) AS Prob
FROM TblProp
GROUP BY [TblProp].[RFPNo];

This query had been working fine for a good long time, but suddenly it starts throwing up this message. I haven't changed anything at all with this query. Its very puzzling. I went through each of the fields and its the comment field that is causing the problem.

Would anyone have any ideas on why this might be happening?

Thanks for reading this!

Polo

View 6 Replies View Related

Export To Excel Seems To Format Data Incorrectly

Aug 29, 2006

I have a standard form with header, detail, and footer sections.
The detail section has a range of calculated boxes and the footer section also has a range of calculated control boxes.

There is a button on the form, which runs the following code:
DoCmd.OutputTo acOutputForm, "Divisions", acFormatXLS, "C: ester.xls", False

This works as far as exporting the Detail section of data. However, as soon as it trys to export the footer section, it just appends them onto the end of the rows.
For example, the report lists:
ABCD 10 20
DEFG 20 30
Totals 30 50

The excel spreadsheet after export lists
Controlbox name Controlbox name Controlbox name cbn cbn
ABCD 10 20 30 50
DEFG 20 30 30 50

Is there a way to:
(a) correct this in the export;
(b) format the spreadsheet;
(c) alternative, e.g. drag the data in from a sppreadsheet ?

View 1 Replies View Related

Forms :: Records Are Sequenced Incorrectly On A Form

Oct 17, 2014

I have created several tables, and also created forms associated with each of them. In every case, the primary key is the first column of the table, and it is autonumbered starting from 1. Every table is sorted by that first column.

In most cases, when I bring up the form that is associated with the table in Form View, as I sequence through the records using the buttons at the bottom of the screen, the records sequence in the order of the autonumbered primary key in the order you would expect (1,2,3,etc)

However, on one form, when I do the same thing, the records sequence through in a different order. When it shows "1 of 21" at the bottom, it is displaying record number 8. "2 of 21" displays record number 13, and so on.

I have doublechecked to see that the associated table is actually sorted properly and it is. I've gone to the Property Sheet in Design view, but I don't see anything that would control the sequence order.

View 9 Replies View Related

Reports :: Number Format Displaying Incorrectly

Sep 19, 2013

I have created a report from a query. The report contains some numeric fields.

I have set the format of the numeric fields to #,###;#,###;0;0;

Despite this setting, my report is showing numbers as #.###

View 1 Replies View Related

Reports :: Text Field Reporting Incorrectly?

Jun 19, 2013

Using Access 2007.

I have a table "StoreInfo" that stores the store number, store address, etc as text fields. I then have created a query gathering this data, specifically store number and address as separate fields. When I run the query, the store number and address are correct. When I use that same query in a report, I have one specific store where all data appears on the report correctly except the store number. The store number is "007" but appears on the report as "137". I was able to correct the problem by changing the store number to eliminate the leading 0's.

Since the field is a text field, I just assumed I would not have any sort of problem with the leading 0's. Once I changed the store number to 107, the problem disappeared.

View 3 Replies View Related

Queries :: Data Comparing And Updating Incorrectly

Apr 17, 2013

I have 2 tables one Access, one FoxPro both containing similar information. The idea of my query is to compare both tables and update the Access table if the value in the FoxPro table has changed. This works fine for a number of similar queries that I have. However, intermittently, this query will see two values as different when they are exactly the same and replace the value in the Access table with a seemingly random value. I know the "Random" values are from other records within the table but cannot see any link between the values.

View 2 Replies View Related

Date Displaying Incorrectly - Numbers Added

Mar 26, 2015

I have recently started learning to use Access and all is going very well except for the date. As can be seen from the images below I have set up my date function correctly in Control Panel and everywhere I use a date it is displayed correctly. In Access however numbers are added which I cannot figure where they are coming from and don't want them there. In the second image you can see what the various Format options look like. When long format is used in a Form or Report it displays those additional figure. I cannot get 2015 to display but get 15316 or similar instead.

View 2 Replies View Related

Error - "This Expression Is Typed Incorrectly, Or It Is Too Complex....

Feb 14, 2008

to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables."

I did a search and it looks like date prompts cause this error sometimes. The message pops up when running from the Switchboard to generate a report. When you hit the button, you are prompted for the Start Date and End Date, but then this message appears.

Running the query directly, not using the Switchboard or Report to generate the data, it runs fine, still using the two prompts.

Any idea on what I should look at to resolve this issue so users can run the report from the switchboard? Let me know if I need to post the sql or something.

Thanks for all replies.

View 3 Replies View Related

Identifying Words Spelt Incorrectly With Numbers Instead Of Letters

Nov 15, 2007

Hello

I have some data I need to clean.
It is in an address field the majority of the data is fine but there are some records with words that have been spelt with numbers:

2 9RAMBLEGATE
2 Forest V1EW
2 KEM8LE Close
2 BELLEMOT4TE Road

Is it possible using a query to find instances where this has happened so I can flag these?

Any help would be greatly appreciated

Tim
:confused:

View 7 Replies View Related

Forms :: Combo Box Populating Underlying Table Incorrectly?

Mar 9, 2015

I am using a form with a combo box (FieldExpenses) that lists from a query row source (SELECT statement). Whether entering a new record or editing an existing record on the form, the selection in the combo box populates the field in the underlying table (TableTransactions) with the row ID (ex: 105), not the desired field (ie: Telephone).

I tried using a split form and the table in the form shows the field correctly. If I open the underlying table separately, the field displays the row ID. It's not working as I wish.

View 2 Replies View Related

Queries :: Importing Excel File With Incorrectly Formatted Date Field - CVDate Partially Functional

Jul 22, 2015

I need to import an excel file with incorrectly formatted date field and it worked only to import them as text:

1 jan 2015
1 feb 2015
1 mar 2015
etc.

Using CVdate converts jan, feb, nov and dec to correct date, but gives an error message with mar to oct.

View 1 Replies View Related

Access Error - "expression Is Typed Incorrectly..."

Sep 24, 2007

I have a functioning query. However, I need to remove the "Term Date" field. When I do that, I receive a message that says "The expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables." The SQL code is listed below. Any help with this problem is greatly appreciated!

SELECT dbo_v_PenLiab_401k_rpt.EMPLOYID AS EmpID,
QryEligibility.EligDate,
Sum(dbo_v_PenLiab_401k_rpt.[Gross Pay]) AS GrossPay,
IIf((Max([dbo_v_PenLiab_401k_rpt]![Check Date])<[QryEligibility]![EligDate]) Or [QryHrsElig]![EligHrs]=1,0,Sum(IIf([QryEligibility]![EligDate]<[dbo_v_PenLiab_401k_rpt]![Check Date],[dbo_v_PenLiab_401k_rpt]![Gross Pay],0))) AS AdjustedGrossPay,
Sum(dbo_v_PenLiab_401k_rpt.[401k Amt]) AS 401kAmt,
Sum([401k Amt])/Sum([Gross Pay]) AS EEDefPct,
IIf(([QryEligibility]![EligDate]>Max([dbo_v_PenLiab_401k_rpt]![Check Date])) Or [QryHrsElig]![EligHrs]=1,0,IIf([EEDefPct]>0.04,0.02,[EEDefPct]*0.5)) AS ErMatchPct
FROM (dbo_v_PenLiab_401k_rpt LEFT JOIN QryEligibility ON dbo_v_PenLiab_401k_rpt.EMPLOYID = QryEligibility.EMPLOYID) LEFT JOIN QryHrsElig ON dbo_v_PenLiab_401k_rpt.EMPLOYID = QryHrsElig.EmpID
WHERE (((dbo_v_PenLiab_401k_rpt.[Check Date])>=[Forms]![ReportDateRange]![Beginning Date] And (dbo_v_PenLiab_401k_rpt.[Check Date])<=[Forms]![ReportDateRange]![Ending Date]))
GROUP BY dbo_v_PenLiab_401k_rpt.EMPLOYID, QryEligibility.EligDate, QryHrsElig.EligHrs, dbo_v_PenLiab_401k_rpt.[Term Date]
HAVING (dbo_v_PenLiab_401k_rpt.[Term Date]=#1/1/1900#)
ORDER BY dbo_v_PenLiab_401k_rpt.EMPLOYID;

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved