473,322 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Getting Sum in Subform (dual combo box driven)

1
Source: this is an access 2003 question
My knowledge level: reading books, internet, and trial & error; no formal training

I'm trying to get a running sum of what's filtered in a subform which is ultimately driven by the results of two combo boxes: 1st combo box on main form that filters desired results for 2d combo box on sub form

Main form: no record source. Has an unbound combo box.
name: frminput
combo name: cboAccounts
The row source for the cboAccounts is a list of accounts from an account table.
---SELECT DISTINCT tblAccount.AcctName FROM tblAccount ORDER BY tblAccount.AcctName;
The AfterUpdate for this combo box has 2 lines:
---Me.Form!subInput.SetFocus
---Me.Form!subInput!cbogroups.Requery

sub-form name = subinput
its control source is from a table that has the fields the user has to input
2d combo box = cbogroups (results driven by what user selects in above combo described for main form)
The combo box row source is from a query which houses the parameter for making my cascade work. This particular query feeds from a table I set up just for the different groups.

My cascade combo box set up works fine in as far as the 2d comb box retrieving results directly associated with the account the user selects.

Here's my problem: the user has to input costs associated with these accounts. But I need a running sum to appear at the bottom of the main form so he can see how much he is spending in the account. Nothing I try works. Various places I've read seem to suggest (in my limited programming understanding that is) that my problem is that the subform is feeding from a table rather than a query, that if I had a query then I could set up calculations to achieve sum results. Is this true???

On the assumption the query was the answer, I did try setting up a subform that feeds off a query rather than a table but then I couldn't get my 2d combo box to work at all.

my subform (which is set to datasheet) looks like this:
group (cbogroups combo box), Jan07, Feb07, Mar 07 (etc for all months) (there are many other fields but for brevity sake I'm only showing a few)

So the user selects an account from the main form, this filters relative groups to the second combo box in the subform, and then from those available groups he selects each one and then inputs costs associated with that group.

EXAMPLE:
Let's say he selected Account: Electrical and that it has groups L1, L2 and L3 associated with that account. For L1 he has $10 for Jan, $20 for Feb; for L2 he has $20 for Jan, $25 for Feb. For L3 he has $100 for Jan $110 for Feb and $300 for Mar. So for Electrical for the year he has spent $585. Down at the bottom of the main form he needs to see the $585 total. It should be an active field that updates as he makes changes in the subform.

The closest I've come to getting this to work was achieving a total for each group (in other words it'd give me L1 total, then when I changed records to the next group it'd give me L2, etc) but I can't get the total for ALL of the groups by an account to appear.

Can anyone help me?
Apr 29 '07 #1
1 3070
MMcCarthy
14,534 Expert Mod 8TB
Put a textbox in the subforms footer to total the required field.
Now put a field on the main form and set it to the value in the aforementioned textbox using the following formula.

Expand|Select|Wrap|Line Numbers
  1. =Forms![Main Form Name]![Subform Name].Form![Subform Textbox Name]
Apr 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: CSDunn | last post by:
Hello, I have a combo box (Combo7) that needs to call a function during the After Update event of the combo box. The function resides in an Access 2000 ADP Module called MMAnswerData_code. The...
0
by: CSDunn | last post by:
Hello, In Access ADP's that connect to SQL Server databases, any time I have a situation where I have a combo box in a main form that looks up a record in a subform, the subform record source has...
1
by: Donna Sabol | last post by:
I have a form (frm_MAIN_RPT) that contains a combo box (Combo6) & subform (dbo_REQ_subform). The combo box is used to select the "cost center" data that will be displayed in the subform. From...
1
by: NBruch | last post by:
Ok let me explain what im trying to do: i need a combo box which needs to be linked to a listbox (or combo box doesnt matter which really) then the listbox should bring up the record in a...
18
by: Robert Jacobs | last post by:
Please advise... I currently have a Mainform (Customers) and a Subform (Service Requests) with a one to many relationship (one customer, many service requests) with a CustomerID that is unique...
1
by: sparks | last post by:
I have a form/table with an autoid it is linked to a table/form with and ID as a 1 to many. Under this form/table I need another table with many records for each on of the many in the previous...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
14
kcdoell
by: kcdoell | last post by:
Hello: I have a form (Default view =single form) with a subform (Default view =continuous forms) embedded into it. In the form I have three controls that display the Division, Working Region &...
5
by: samdev | last post by:
I have created two combo boxes in a subform.... For example 1. Combo Box State 2. Combo Box City 3. When a state from the Combo Box State is selected, the City combo box updates to reflect...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.