Access 2013 Sum field column by ID number - ms-access

My simple form
Here is my simple purchase order form.
The form based on 2 tables. One named POMaster (data being POID and PODate) and the other one named Items(data being What you see plus a type called POIDno which is linked to the POID field to store items by POID)
How do I get Text10 to equal the sum of ItemTotal Column (By POID ofcourse) and if possible How do I get this value to store in a (hopefully) new data field in POMaster I would name POTotal?

Put a hidden total text box on the sub form and set your text box to the value of the hidden control.
You shouldn't store the value in the header as it can always be calculated.
However if you are storing it, you would have to determine a specific point in your process and ideally make sure no more updates can be made to the order lines, as that would mean having to re-calculate your stored value.

Related

List report, filter by letter

I am building a summary report which looks at users that are marked in a database as having a common trait i.e return all users by name in the last 5 years whose contract contains an end date.
This generates a figure e.g. [250]
I drill through on that figure to give a list report of names, first name and surname.
I have ordered the list A-Z
I would like to add a row of 26 letters at the top of the report and have each letter return only the names with the corresponding starting letter.
Would this need to be a further drill through or is it possible to refresh the existing list based on a user-driven selection?
Just add a custom parameter to your report. Right click on Parameters and Add Parameter.
(and so on...). Default value should be All then.
Then simply add the following filter to your tablix:
'Expression:
=Switch(Parameters!YourParameterName.Value = "All", True, Parameters!YourParameterName = Left(Fields!YourNameField.Value, 1), True)
If you are just using SSRS as it comes, then you can't refresh report content without running the report again, so you would either
re-organise your current report.
need another drill through report.
Depending on your layout you could group the data by the first letter and then have an collapsible row group to show/hide that group of names. To do this simply add a parent row group, set the value, group value and sort value all to =LEFT(Fields!myNameField.Value). Next set the visibility of the details row group to hidden and set the toggle visibility property to point to the cell that contains the letter from the parent group you just created.
If you have too much data to make this efficient the you might have to go down the additional subreport route.
To make life a bit easier, and to save you having to create 26 links and parameter values, I would do the following...
Create a table that stores the list of letters
Add a matrix to your report, that has a column group grouped on the letter value from this table. This will act as your 'filter bar'
Set action on the matrix cell to "go to report", point to the final drill thru report and pass the [myLetterColumn] value as the parameter.
There's no need to set available parameters assuming this sub-report will be hidden and only called from the parent report.

Combining DMax with Dlookup to find value from last row created

I have an access database that tracks reports numbered in this way:
NNN-[two digit site code]-YY0000
The “0000” is a sequential number assigned as the reports are issued.
Examples are: NNN-SD-180001, NNN-MA-180002.
tbl_NNN stores the records.
NNN_ID is the column that stores the report numbers.
The report numbers are manually assigned, so we must keep track of the last assigned number to prevent “duplicating” the sequential 0000 number. Since users do not have visibility to the entire table of assigned numbers, they do not know which is the last number assigned. To assist them, their dashboard/form has a label that displays the last number issued. The problem we have is that the label only shows numbers that include the SD site code, MA numbers are not displayed.
My solution was to add a column named “Date_Created”, which adds a =Now() time stamp whenever a new row/number is created in the table. With the timestamp, I then intended to use Dmax to display the report number that corresponds to the last row created, regardless of the report number.
I know what I need is a combination of DLookup and Dmax, but what I came up with displays
"#Error"
in the label.
=DLookUp("NNN_ID","tbl_NNN","[Date_Created]=" & DMax("[Date_Created]","tbl_NNN"))
Am I writing this correctly?
You are close, but you must use single quotes (or unreadable expanded double quotes) for the embedded DMax:
=DLookUp("NNN_ID","tbl_NNN","[Date_Created] = DMax('[Date_Created]','tbl_NNN')")

Calculated Textbox based on values from two fields in a form

I am having trouble trying to create an expression that will give me a total based on two values in two different text boxes.
I created a form that has a text box called Niin, textbox called variance, textbox called price and textbox called Total.
I also have a table called NIIN_PRICE that has a NIIN column and a price column next to the associated Niin.
The result i am seeking is:
Have the value entered in textbox Niin lookup the corresponding value in Table NIIN_PRICE WHICH will then output the price into the Price textbox.
I will then want the total textbox to be an expression by multiplying the value in variance textbox with the value in price textbox and get the total of both numbers.
Example:
I type 1234 in NIIN textbox in my form,
1234 is searched in the NIIN_PRICE table and returns the value of .25. .25 is added to the price textbox as an output.
i then type 4 in the variance textbox which will update my value in the total textbox to 1 (.25 from the price pull Multiplied by 4 from my variance input).
Is this request possible? Thank you for the help.
theForm might look like this>>
tbxNIIN tbxPrice tbxVariance tbxTotal
on tbxNIIN event tab add AfterUpdate sub
that reads the NIIN_PRICE table and copies the value to tbxPrice
and then clears tbxVariance and tbxTotal
and sets cursor to tbxVariance.
On tbxVariance event tab add AfterUpdate sub
that multiplies the two and puts the result in tbxTotal

Combobox selection items different from display items

I have a code table that is a used in a combobox. It has an attribute on each code called "isActive" which has a value of "Y" or "N". The code table combobox is used to classify transaction data on the Orders table. For example:
ID Code isActive
-- ---------- --------
1 Repeat Y
2 New Y
3 Discount N
I want the list of items to include items that are no longer active (isActive="N") so the text can be displayed if someone looks at an old record that used a code that is no longer active. For example if an Order from last year was classified as "Discount" I want that to show when they look at the order.
However, I want the drop-down list for new orders NOT to display codes that are no longer active, since they only clutter the display. If the drop down only includes the codes where isActive="Y", then the order from last year with the code of "Discount" shows up blank.
How can I get the best of both worlds here?
If you don't have a particular row visible in the combo list, the combo won't display the text corresponding to the combo's value - no exceptions.
However...
If you sort the isActive = "N" entries to the bottom, then sort by ID or Code as usual, then the inactive entries won't clutter the list (as much), but will still display correctly. This is most easily done with a query bound to the combo's recordsource.
You can also display the isActive column so the users will know what they can and can't select, and prevent selection of isActive = "N" entries in the combo's BeforeUpdate event.

SSRS. Hide a Column based on Row Group Value

My application uses SSRS to produce payslips for employees. The Payslip report consists of a tablix with 5 columns. Among the 5, is a column called "Units" and another called "Invoice value".
The report has several Row Grouping levels, but the only important one for this question is the Payslip Number Row Grouping "RG_SlipNum". There is a page break after each "RG_SlipNum" RowGroup.
When users want to print Payslips, they can optionally supply up to 5 parameters which filter the result set to print out.
Employees can be paid based on the number of units delivered * a rate (Unit Based), or by a percentage of the invoice value (Invoice based) for the delivery (Oversimplified, but hopefully, you get my drift).
If the employee is Unit based I want the Units Column to Show, and the "Invoice Value" Column to be hidden. If they are Invoice based I want both columns to show.
My dataset has a bit field indicating whether to show or hide a column based on the logic above. It will be a 1 or a 0 for every underlying row within the current rowGroup. I have tried to use the First(,) function in a Column Visibility expression on the "Invoice Value" Column. However, I get the following error whenever I try to limit the scope of the First Function to the current Payslip Rowgroup using the RowGroup name.
"The Hidden expression for the tablix 'X' has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a dataset. "
So, my Question(s)
Can you define a RowGroup name as the Scope argument in a First() function?
If not, What's the best way of achieving this without completely re-working my Dataset / RDL to accomplish this. (Using SSRS2008)
Why is it always just after posting a forum question, you figure it (or some workaround) out?
I'd still like some (better) answers if anyone sees this, but I've set a cell in the tablix to the value of the bit field that determines whether to show the column or not. I then changed my Column Visibility expression to check the cell value (using ReportItems!textboxname.Value) and it's working. as I scroll the payslips the columns visibility changes appropriately.