Microsoft Access - Scrambling Totals - ms-access

I'm currently in the process of coding a summary report in Access XP for a client and while for the most part I've gotten 99% of the fields to match correctly with the original report (created in Corel Paradox 4.0), I'm having an issue with a sum field where despite using the same set of data, I'm getting invalid answers.
For example, in one table, the sum of the fee field comes to 9,050 in the Paradox report. In Access, the table containing the data also comes to that same amount. Despite this, when I enter the expression in my Summary report, Access will always display the total as 9,005.
I've been trying to use the NZ function to cancel any nulls, however that hasn't helped. Changing the number format to currency, general, and other formats also hasn't been helping.
Any assistance/insights are greatly appreciated.
EDIT: As requested below are some of the expressions from my Access report. Everything up till now has strictly been Access code, but as I have SQL experience, I am open to implementing that type of code if needed (it actually has been on my mind for a bit)
=nz(Sum([Fee]))
Calculates just the total fees
=nz(Sum([Room & Meals]))+(nz(Sum([Commutter & Meals])))+(nz(Sum([Fee])))
This we use to calculate the grand total. It also comes out identical to the fee total for my dummy data since the first two fields don't have any totals added to them.

Not sure this will help, but you need to break this down to trouble-shoot.
Capture the detail data from this report and compare to the Corel Paradox data. Don't just test the totals. Maybe you can put them in Excel.
Break out the three fields individually and sum those: Sum([Room & Meals, Sum([Commutter & Meals, Sum([Fee]). Don't format. Manually add them together to test.
Are these integers or is there some rounding going on?
Are the text boxes on the report large enough to display the entire number?
1 may show you're comparing apples to oranges.

Related

MySQL Storing Reports

I am looking for a way to store auto-generated reports. There are about 10-15 columns and 100-3000 rows depending on the report but each report is consistent in column count.
I am looking for a way to organise and store these reports into a large group without creating an entire new database and 1000s of tables to store each indervidual report.
The reports need to be queryable so they can be subdivided by team/area/person etc as each report can be a combination of 3-4 different sub-reports depending on how you split/sort the data.
I am using Python to collect and sort the data from the database so using MariaDB/MySQL would be preferred but im happy to use something else if there is a pre-exising connection libary for it.
To sum up i need something similar to a excel spreadsheet with each table being a sheet and sheet name being the date it was generated so i can select by the date generated.
Think through the goals.
Is this a legal issue -- you need to produce an unalterable report as something "official". A la a non-editable .pdf?
(at the opposite extreme) Be able to generate (or regenerate) any report for any timeframe.
Is performance an issue? (Either perceived or real)
I like to build and maintain Summary Table(s) for any "Data Warehouse" application. And build "reports" that take as a parameter a date range and a small number of other things. And have the report generation so fast that it does not matter if multiple people are pulling reports at random times.
15 columns and 3000 rows is usually excessive. If pulling a report is trivial enough, it can be less 'massive'; just get the parts you want, without such bulk.
http://mysql.rjweb.org/doc.php/summarytables

MS Access: Query Expression Error

I've got an access database to keep track of a number of awards to different people. They split the award by taking a given percentage (Yes, I realize the percents don't add up to 100, I'm just testing it right now). As of right now I have one column dedicated to calculating the first person's split of the prize money. However, I'd like to instead do this with a query instead.
I've created a query to total all of the awards received by a given person, starting with the first column for testing purposes. The query first gathers all the awards in which a given person has a share, then in a separate field multiplies the award by the percentage taken. However, after entering the person's name in the dialogue box, I get this error returned that says my expression isn't typed correctly.
I've tried several different things, from changing the formatting of the columns, to editing the expression in the final field where the calculation is done. I can't figure out why this is happening. Am I missing something obvious?

Adding Access totals cause report to not run

I am trying to add a few totals (sums and counts) using the wizard to an Access report. When I add them to the report and try to view the report, the report fails. Without the totals the report will display. The only thing I can figure that may be a factor is that the query being run to populate the report takes a bit to execute. The query runs a series of other queries which takes longer than normal to generate the report.
ETA: Thank you dmoody007 for your help in rooting out the problem and confirming my suspicions.
The question is a little vague. Any of these can either display errors or cause the report to not run.
Use Control Name in detail section of report for totals field (example: Name is Overtime so total of overtime should appear like =Sum([OverTime]))
Be careful not to name your controls the same. Detail control can be named Overtime. Your total of overtime should NOT be named overtime as well. Name it like Tot_OverTime otherwise you could end up with a circular reference.
If counting a text field, know that null fields are an issue. Suggest counting identity seeds or fields you know always have a value.
Make sure each control in detail you plan to sum, is formatted for numbers. If you look at the control property, format should be a number and you can assign decimal places. If not, you need to check your query or source table to ensure field is properly assigned a format.
One good tip. Add one field to total at a time. A little tedious but ensures one works before adding the next. Always recommend this to newbies until they get real comfortable making reports. Easier to debug.
Good Luck.

Microsoft Access - Variable Overrides in Reports

I'm currently in the process of creating an extensive Access report (~50 calculated fields) for a client and while I've gotten 99% of the report down, I'm having trouble handling the Sum and Count logic on the report.
In a nutshell, the report is intended to list the attendees at an event, tally up the number of attendees at each track/course, and also list any outstanding dues which will be paid at the door. In addition, and this is where I'm having trouble, the report also shows the revenue from each track/course along with a breakdown of the revenue from commuters vs. people staying overnight.
At the moment, all of the formulas follow fairly similar structures so despite having 50 fields, 99% of those are simply adjusting the fields to fit the relevant variables.
For the report now with revenue, my issue is that although I have the fee data specified in the data tables, Microsoft Access keeps zeroing out the calculations rather than displaying the total on the fly.
Here's two of the formals I'm using:
=((Count([W1]))*[Fee Charged W1])
=Sum([Room & Meals])
Earlier today I think I pinpointed the problem to the fact that Microsoft Access is showing the report essentially per individual rather than displaying one report for the entire dataset. I've confirmed this because I manually checked the data and noticed some fields had null values which explained the null tallies.
My question now is whether there is a way to assign a default value for variables in reports so that the report cancels out any invalid data in the database table? I imagine using VBA would help, but I have little experience in that realm.
Thanks very much in advance for any assistance
Just found the solution which was right under my nose the entire time. I just had to configure the fields to use a Running Sum (also called a Cumulative Total).
The answer came right from a page in the Microsoft Office Website: http://office.microsoft.com/en-us/access-help/summing-in-reports-HA001122444.aspx

How to avoid summing of numbers in report model in SQL Server Reporting Services

In a report model I have some entities which have attributes which are integers (set to integer datatype) but should not be summed or aggregated in any way.
For examples ID's.
But when I create reports with the wizard, sometimes the report builder will try to sum the values even though it doesn't make sense to sum ID's.
For example let's say I have a list of cars sold in a month. In january I've sold 2 cars, one with the ID 101 and one with the ID 210. In report builder I will then - when using the wizard - get the number 311 for the summed values. I can remove it afterwards, but I would like this to not happen at all (since the end-users will be confused)
I need a way to say to the report model: This is an integer, but it is not really a number you should sum up
Well the wizard isn't perfect as you've found out. It does it's best in trying to figure out what to do. All that you can really do is remove =Sum(carID.value, "datasetname") when it automatically puts it there. Or if you don't need to sum anything at all delete the footer of the table. A workaround perhaps would be to do a Convert in your SQL to make your ID's a varchar.
If you drag an integer field onto the table it generates a sum by default. This is not always what you want - e.g. when the field is an Id or a status code that is the same for all rows shown.
Right-click the "<<Expr>>" and bring up the "Expression..." dialog. Replace "Sum" with "First" - e.g. =Sum(carID.value, "datasetname") becomes =First(carID.value, "datasetname") If the values are the same in all rows, then the first value will do. If not, there are also other functions like Last, Min, Max.
This is a bit of a kludge, but it works for me. I used my text editor to edit the RDL (XML) file and replace "Sum(" with "", then searched (carefully) for the ")" and replaced with "". I only replaced this inside of the ... Reopen in report builder without issues.