Solved

Problem with total in footer of form - #Error

Posted on 2012-12-22
9
1,583 Views
Last Modified: 2012-12-22
I’ve had problems with subtotals in forms in the past but always have been able to resolve them by going over syntax with a fine-toothed comb and finding an error on my part.  In this case I have done that for hours and cannot figure out what I am doing wrong.  Here is the scenario:

Access 2013 linking to MS SqlServer database view.  
Field is ‘CalculatedValue’, placed in a text box ‘PrintTime’ .  The field displays the correct values one each row.  
'CalculatedValue' displaying on each row
In a text box on the form footer, I use the control source =sum([CalculatedValue]) and get #Error#Error  &*$^@!.


I can replace that control source with =[CalculatedValue] and get the value of whichever row is active.  But as soon as I edit the controlsource to =Sum([CalculatedValue]), the #Error returns.
total box displays 'Calculated Value' correctly...
What am I doing wrong?  

(NB: I upgraded to 2013 today just to see if it would resolve this issue or at least have better error description to help...)
0
Comment
Question by:susanhibbard
  • 4
  • 4
9 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 38716247
You can't sum a calculated field.

Try summing the expression that defines the calculated field instead.
0
 

Author Comment

by:susanhibbard
ID: 38716281
I realize that the name of this column (CalculatedValue) is confusing, but it is NOT a calculated field. That is just the name of the column, it refers to the fact that the underlying data is calculated before being written to the table.  

I didn't design this database...

Thanks anyway.
0
 
LVL 57
ID: 38716320
Check the field data; do any rows return something other then a numeric?

Jim.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:susanhibbard
ID: 38716431
No,I don't think so - data type is number:

snip of 'design window' of linke Sqlserver view
I can run this query in Access and it returns the correct number:

SELECT sum(calculatedvalue) as totaltime from dbo_vCyrTransHdrdetParts

the linked table is actually a view in Sqlserver - that would not have any effect would it?
0
 

Author Comment

by:susanhibbard
ID: 38716435
Actually, to be more specific, the record source for this form is an Access query which is base on the Sqlserver query + one calculated column... not the column in question however.

Just in case any of that matters...
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 38716484
Try this to isolate this and rule out other possible issues with your form...

Create a new form bound to the same recordsource and just add that one textbox, summing that field in your forms footer section.
0
 

Author Closing Comment

by:susanhibbard
ID: 38716489
Good idea, I had just decided to do essentially the same thing myself - started from scratch on the form and it worked just fine.  This was a redesign and I reformatted an existing form - apparently a bad idea which undoubtedly cost me far more time than it ever saved...

Thanks for the suggestion!
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38716492
Hmm... the test that you ran was directly on your sql table, but you mentioned your form being bound to an Access query.

Try running that same test (your sum query) against the Access query that your form is bound to
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38716494
Ah. Missed your last post.  Glad its resolved...
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA Access 2016 syntax 6 43
sql statement - 9 25
Attachment field in SQL 3 28
VBA SQL statement - 2 "OR"s and 1 "And" 4 27
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question