Adding footer to report causes erros [MS Access 07] - vba

I have a form that opens a report based on two combo boxes. It is opening an invoice for shipments. You can either open the report based on customer or shipment. Everything works fine for shipments and the total for all items is added correctly. However when I add a grand total within the page footer I am suddenly unable to open the form because access asks what the total is. I have a attached a picture to help explain better.

Access does not store the values of calculated fields. As a result you can't sum the values that it produces. Instead of summing the calculated field, sum the calculation used to produce it.
example:
textbox24 = nz([TL],0) + nz([TM],0)
to sum this field use:
sum_field = sum(nz([TL],0) + nz([TM],0))

Related

SSRS report that outputs the number of invoiced lines with a group by

I've never used SSRS before so I'm not too familiar with its capabilities. I need to make a report that is grouped by Division Code, and then counts the number of invoices that are the same (by Invoice Number), and displays that in a column (I called it Invoice Lines). I'm trying to get something that looks like this:
And this is what I have so far, I know that the Invoice Lines value should be an expression, though I am not sure what expression to use or how to get it to work. When I created the report, I put all the fields in the details section and the Division Code in the group by section using the report wizard, but I'm not sure if that's right either as its not displaying anything when previewed:
Image added of trying count expression from comment:
If you have grouped it by invoice number, then just an =count(Fields!Invoice_no.Value) should do the trick. Just ensure that this expression is on the grouped column header and not on the details line itself.

Make a Crystal Report selective over the data that it shows

I have many reports in a project, each showing different data about different things. I have shown the user the project, and his main feedback was this:
I like the reports, however I notice that in a lot of them, the tables show all of the columns that meet the report criteria (what the report is showing), even if they are empty. Can you change them so that if a column is empty, it is not displayed, as this takes up needless space?
Is there a way I can achieve this? For example, if the report is Sales by Customer x by Suppliers, and one supplier has no data for this customer, I don't want that supplier to be shown. Is there a way I can get the report to only display columns if they contain data?
To clarify, the effect I am after is, if the report below was shown, the column Arris Rail (144) 75x75 1.282m would not be displayed.
Right click on crostab > Cross-tab expert > customise style
set option Suppres empty columns
I think you need to replace "-" value to null or empty

SSRS - Aggregate of an Aggregate

I am new to SSRS but have plenty of experience with Crystal Reports and am trying to do something that in Crystal is fairly simple but after hours of frustrating research it appears is very difficult in SSRS.
I have looked at these which bring me close:
Running Total Over Aggregated Data
Aggregate Of Aggregate
I can semi-successfully obtain a group total but the group total resets to zero at the beginning of each page which isn't what I want.
I have two groups in my report the nested group has subtotals which are not totals of the detail data. How do I create Group Totals for the nested group subtotals? I have seen many people asking this question but so far have only been able to successfully create a Report total for the nested group subtotal. Can any one point me to a way to solve this?
It appears that this area is a regularly encountered problem that has no resolution. I see the same question raised here SSRS Aggregating Aggregates also with no resolution. I was hoping it was just a knowledge issue on my part but it appears to be a structural issue with SSRS.
OK So it sounds like you want to have a Subtotal and Grand total?
https://msdn.microsoft.com/en-us/library/ms170712.aspx
In this example it is the typical sales company
first line totals are easy, but the subtotal for the "daily group". Obviously you will have different groups/column names, but I think this is what you are looking for.
Right-click the Order cell, point to Add Total, and click After.
This adds a new row containing sums of the quantity and dollar
amount for each day, and the label "Total" in the Order column. Type
the word Daily before the word Total in the same cell, so it reads
Daily Total. Select the Daily Total cell, the two Sum cells and the
empty cell between them. On the Format menu, click Background Color,
click Orange, and click OK.
Then for the grand total
Right-click the Date cell, point to Add Total, and click After. This
adds a new row containing sums of the quantity and dollar amount for
the entire report, and the Total label in the Date column. Type the
word Grand before the word Total in the same cell, so it reads Grand
Total. Select the Grand Total cell, the two Sum cells and the empty
cells between them. On the Format menu, click Background Color, click
Light Blue, and click OK.

Images in Crystal Reports

I am working on Windows Forms Projects.
I am creating a report for customers.
The report data is pulled from a "CustomerDetails" table.
A field in the table is called "CustPhotoName", this holds a string which relates to an image file.
I Currently have a report set up which runs for a single customer by passing in a customer ID. Then using the passed in ID to populate a Dataset with an ImageRow and then a sub report with the image from the dataset.
I am wanting to set up this report where I can pass in an array of customer IDs and produce the reports (1 page per customer with image (if CustPhotoName has value))
Please can someone let me know how is the best way to do this for the multiple customers.
Add a CustomerID parameter to the report. Type Number. Set it to allow multiple values. In the report's record-selection formula, add the following:
AND {table.customer_id} IN {?CustomerID}
You probably want to group the report by {CustomerID} as well. In the group's footer, select Section Expert and check New Page After. This way each customer will start on a new page.

MS Access sum of related records

I have a purchase form that has a continuous subform which shows line items for that purchase. Each line item needs to include a text box that shows the sum for a number of related records in a table for that line item.
(Each line item is allocated for a specific purpose(s). For instance, a line item says that 100 widgets are ordered; the allocation table says that 20 widgets are for this purpose and 40 are for this purpose. The text box needs to say that 60 / 100 are allocated.)
I have written this in VBA for the OnCurrent event of the form, but this only occurs when the first "copy" of the continuous form receives focus. Then all the other "copies" of the form show the same values in the text box.
I then realized that I could perhaps do this as part of the query for the form. Whenever I add ... Sum(Quantity) AS TotalAllocations to the SQL query, I get the following error:
"You tried to execute a query that
does not include the specified
expression 'VendorPartNumber' as part
of an aggregate function."
(VendorPartNumber is a field for the records that show up on the continuous form.)
Can someone explain how to do this successfully in a query designer / SQL view or with VBA?
Complete aside:
Ideally, it would be nice to have this as a continuous subform on a continuous subform. However, Access does not allow continous subforms on continuous subforms.
If you're going to SUM in SQL, you need to include a GROUP BY clause for the non-aggregated columns, such as:
SELECT VendorPartNumber, Sum(Quantity) as TotalAllocations
FROM YourTable
GROUP BY VendorPartNumber