473,748 Members | 6,037 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting Sum in Subform (dual combo box driven)

1 New Member
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.Acct Name FROM tblAccount ORDER BY tblAccount.Acct Name;
The AfterUpdate for this combo box has 2 lines:
---Me.Form!subInpu t.SetFocus
---Me.Form!subInpu t!cbogroups.Req uery

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 3102
MMcCarthy
14,534 Recognized Expert Moderator MVP
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
2293
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 following is the code of the function: Public Function SubFormRS(FrmTarget As Object) Forms!frmAD_OpeningForm!FrmTarget.RecordSource = "EXEC dbo.AdSubFormRecSource " & Forms!frmAD_OpeningForm!SubFormFilter
0
2353
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 to be based on either a View or a Table. I can almost always use a View, and it helps to do this since I can have better control over the size of the RecordSet of the subform. There are times when the use of a Stored Procedure would give me...
1
3484
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 there, I have a button that runs a report based on which item I select in the subform. 1. The Combo Box correctly displays the list of cost centers within the combo box. 2. The subform, when opened separately, correctly displays the data for the...
1
2154
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 subform. so you pick a name (in the combo box in the main form) then it should bring up all the dates for which the person has a record for (in the list box or combo box) and then once you pick a date it should bring up the specific record you want...
18
3607
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 for each customer and is autofilled on the subform. Subform contains field called TicketID (which there could be multiple instances of and is not referenced on the mainform at all). I want to be able to type in a TicketID and have the mainform...
1
1606
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 table. form1 form2 form3 table1 table2 table3 autoid -1-------------@ ID -1-----------------@- ID2 of course it won't allow this so I put in a second ID
6
3682
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
2348
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 & Credit Region. The subform displays the data/records. The record source for both my form and subform is driven by a query, which is the way I filter the records that the end user will see via another form I created. Everything is working fine but...
5
4902
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 the State chosen by only showing cities in that selected state. 4. When I open just the subform it works just fine but when I open the
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.