Access 2010: Expression to count number of items in a multivalued field - ms-access

In Access 2010, I have a table with a multivalued field. On my form, this field is represented as a list where I can check as many values as I want. I want to display the number of selected items. I try using
=Count([MyField])
but it gives the total number of selected items in all records. How can I get the count of selected items in the current record only?

Related

MS ACCESS - SUM

I have a form called Items list which stores multiple values for one project. i have a total for each item that is added (as seen in picture) i would now like to make it so that the "overall Total" field stores the overall total for the items for that project.... and then store it in a new field in the table.
SELECT SUM(TOTAL) FROM TABLE
If necessary add the Total textbox value to above result, when any value(s) are edited in screen

SSRS - Print Grouped value on each page

Made a report that displays a bunch of invoices based on date range and InvoiceNumber. User can get all invoices in the range or select individual invoices. Each invoice is displayed on a new page (grouped on invoicenumber with page break).
Problem I am having is I want the invoice number displayed on each invoice. Because one of the parameters for the report is the invoice number, I had to supply available values. I tried to get them from the main dataset, but I get an invalid report parameter dependancy errorsaying InvoiceNumber has a default value that depends on the report parameter 'invoiceNumber'.
So I created a second data set with just the invoicenumbers and that got rid of the error, but then I got an ambiguous field reference error on my InvoiceNumber field due to the 2 datasets with invoicenumber. I added first(fields!InvoiceNumber.Value, 'dataset1') but now it displays the same invoice number on each page (obviouxly because of the First().
So How do i get the invoice number for each invoice to display on each page?
A good way to handle this type of scenario is to take advantage of the scope that groups provide.
Create a table with one cell.
Set the cell to be grouped by invoice number.
Insert a rectangle into the cell.
Make the cell fill the entire page and place everything else inside it.
Now any tables or textboxes on the page are naturally scoped to the invoice for each page without having to worry about individual filters. In other words, =First(Fields!InvoiceNumber.Value, "dataset1") will give the correct invoice number on each page.

Looking for a way to zero out the value for a particular field if criteria matches a list within a table in Access

The query returns a list of store numbers (str_nbr) and their corresponding number of packages sold (Packs); I want to make the packages sold zero if the store number is listed within a table called Closed/Excluded Stores (ABC) that only has one column (Store)
IIf([str_nbr]=[Store].[Closed/Excluded Stores (ABC)],0,[Packs])

Filtering a Listbox based on Combobox selection

I have two tables: Person and Shift
Person has as lookup field which is a one to many relationship with Shift.
I would like to create a form in which a listbox displaying records from Person is filtered based on the selection of a combobox containing the records from Shift.
in other words, i want to select "days" (value 1) in the combobox, and have only the records from Person that have value 1 in their Shift field displayed in the listbox?
the equivalent sql would be something like:
SELECT * FROM Person WHERE Person.Shift = (the value of the combobox here)
Also, if possible, i would like to do this with little to no VBA as the person i'm passing this off to has no VBA experience and can't be expected to fix bugs in the VBA code.
All you have to do is use the query builder in access and set the criteria to the value of the first combo box
[Forms]![frmMy_form]![cboFirst_combo_box]
Then in the after update event of the first combo box just put
Me.Second_combo_box.Requery

Selecting total results on a report

I have a matrix with several columns and rows. Example the rows are made up of names for a company and along the top are total sales, total calls, etc. So each row will have a number under each column, and at the bottom of each column is a total for each column. Currently i have the report set up that if you click on any of the numbers it pulls up a detailed report for those particular items. But if you select the total number it brings up the results for the first row's column. Is there a way to make it return all the items details when you click the total number for that column instead of what ever the detail would be for the first row of that column? Does this make sense?
You can use the inscope function to check whether you are in the value or total row. If you are not in scope then pass the correct parameter to the details report.