473,660 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Subform total on a main form

JustJim
407 Recognized Expert Contributor
I must have Friday-itis!

I have a main form which has a sub-form. The sub form is shown as a datasheet, but in design view I have a control on the Form Footer which totals a field on the Detail area. This works fine for the subform when displayed by itself as a single form (including applied filters to simulate being used on the main form) and naturally the total field doesn't appear when the sub-form is shown as a datasheet.

On the main form there is a control which refers to the sub-form and to the total control in the following way

Expand|Select|Wrap|Line Numbers
  1. =sfrmSubFormName!txtTotalControlName
  2.  
and it just sits there empty! No #ERROR, no #NAME?, no nuthin'!

The spelling of the sub-form name and control is correct, I had two other people look at it.

I've done this a million times (Hyperbole alert!), perhaps I shouldn't have had that last glass of red while watching the cricket last night!

Drat! I'm actually going to have to submit this... I was hoping that just typing it out clearly would make something go Click! in my (admittedly fuzzy) brain, but no, not yet.

Jim
Sep 21 '07 #1
5 2716
ADezii
8,834 Recognized Expert Expert
I must have Friday-itis!

I have a main form which has a sub-form. The sub form is shown as a datasheet, but in design view I have a control on the Form Footer which totals a field on the Detail area. This works fine for the subform when displayed by itself as a single form (including applied filters to simulate being used on the main form) and naturally the total field doesn't appear when the sub-form is shown as a datasheet.

On the main form there is a control which refers to the sub-form and to the total control in the following way

Expand|Select|Wrap|Line Numbers
  1. =sfrmSubFormName!txtTotalControlName
  2.  
and it just sits there empty! No #ERROR, no #NAME?, no nuthin'!

The spelling of the sub-form name and control is correct, I had two other people look at it.

I've done this a million times (Hyperbole alert!), perhaps I shouldn't have had that last glass of red while watching the cricket last night!

Drat! I'm actually going to have to submit this... I was hoping that just typing it out clearly would make something go Click! in my (admittedly fuzzy) brain, but no, not yet.

Jim
Try a change in syntax:
Expand|Select|Wrap|Line Numbers
  1. =Me!sfrmSubFormName.Form!txtTotalControlName
Sep 21 '07 #2
JustJim
407 Recognized Expert Contributor
Try a change in syntax:
Expand|Select|Wrap|Line Numbers
  1. =Me!sfrmSubFormName.Form!txtTotalControlName
Well Access is paying attention, that gets me a #Name? error. I even thought to really tell it what I wanted by adding
Expand|Select|Wrap|Line Numbers
  1. =Me!sfrmSubFormName.Form!txtTotalControlName.Value
to no avail.

Interestingly, when I leave out the .Value in the Control Source box of the Properties window, Access leaves it exactly as I typed it but with the .Value it puts [ and ] around all the bits
Expand|Select|Wrap|Line Numbers
  1. =[Me]![sfrmInvoice].[Form]![txtInvoiceSubTotal].[Value]
Strange animal!

Jim
Sep 21 '07 #3
ADezii
8,834 Recognized Expert Expert
Well Access is paying attention, that gets me a #Name? error. I even thought to really tell it what I wanted by adding
Expand|Select|Wrap|Line Numbers
  1. =Me!sfrmSubFormName.Form!txtTotalControlName.Value
to no avail.

Interestingly, when I leave out the .Value in the Control Source box of the Properties window, Access leaves it exactly as I typed it but with the .Value it puts [ and ] around all the bits
Expand|Select|Wrap|Line Numbers
  1. =[Me]![sfrmInvoice].[Form]![txtInvoiceSubTotal].[Value]
Strange animal!

Jim
The problem is not Value, since it is the Default Property of a Control and does not ned to be explicitly stated. If I had to venture a guess, it would be that you are referencing the Sub-Form itself and NOT the Sub-Form Control, namely the syntax should be:
Expand|Select|Wrap|Line Numbers
  1. =Me!<Sub-Form Control Name>.Form![txtInvoiceSubTotal]
  2.                      NOT
  3. =Me!<Sub-Form Name>.Form![txtInvoiceSubTotal]
Sep 21 '07 #4
JustJim
407 Recognized Expert Contributor
The problem is not Value, since it is the Default Property of a Control and does not ned to be explicitly stated. If I had to venture a guess, it would be that you are referencing the Sub-Form itself and NOT the Sub-Form Control, namely the syntax should be:
Expand|Select|Wrap|Line Numbers
  1. =Me!<Sub-Form Control Name>.Form![txtInvoiceSubTotal]
  2.                      NOT
  3. =Me!<Sub-Form Name>.Form![txtInvoiceSubTotal]
No, I knew it wasn't the .Value, I just thought the formating that Access did was interesting.

OK I deleted the subform control on the form and put it back. The actual form I'm using is called sfrmInvoice and it has a control on it's footer called txtInvoiceSubTo tal and its Control Source is
Expand|Select|Wrap|Line Numbers
  1. =Sum([InvoiceAmount])
where InvoiceAmount is a control on the Detail of sfrmInvoice. In Single Form view, this control adds up all the InvoiceAmounts and if I filter the form, it adds up just those InvoiceAmounts. So far, so good.

On the main form, the sub-form is called sfrmInvoiceCont rol and there is a text box on the main form called txtInvoiceTotal whose Control Source is now
Expand|Select|Wrap|Line Numbers
  1. =[Me]![sfrmInvoiceControl].[Form]![txtInvoiceSubTotal]
This gives me a #NAME? error!

Cheers

Jim
Sep 24 '07 #5
JustJim
407 Recognized Expert Contributor
No, I knew it wasn't the .Value, I just thought the formating that Access did was interesting.

OK I deleted the subform control on the form and put it back. The actual form I'm using is called sfrmInvoice and it has a control on it's footer called txtInvoiceSubTo tal and its Control Source is
Expand|Select|Wrap|Line Numbers
  1. =Sum([InvoiceAmount])
where InvoiceAmount is a control on the Detail of sfrmInvoice. In Single Form view, this control adds up all the InvoiceAmounts and if I filter the form, it adds up just those InvoiceAmounts. So far, so good.

On the main form, the sub-form is called sfrmInvoiceCont rol and there is a text box on the main form called txtInvoiceTotal whose Control Source is now
Expand|Select|Wrap|Line Numbers
  1. =[Me]![sfrmInvoiceControl].[Form]![txtInvoiceSubTotal]
This gives me a #NAME? error!

Cheers

Jim
Sometimes it's not about Me!
Expand|Select|Wrap|Line Numbers
  1. =sfrmInvoiceControl.Form!txtInvoiceSubTotal
Jim
Sep 25 '07 #6

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

Similar topics

1
2482
by: Mary Ann | last post by:
I have a main form with 4 subforms. One of the subforms reflects other costs/miscellaneous charges that an account might be assessed. The main form includes a field with a total pulled from that other cost subform. The total field reflects the correct amount as long as there is at least one record for the account in the other cost subform. However, many accounts won't have other costs assessed so those accounts are not in the query for...
0
1950
by: Ellen Manning | last post by:
I've got an A2K form with a subform based on a query. This query has a checkbox and an amount field and returns records if checkbox is checked. I Dsum the amount field and display on the main form. If the user unchecks the box, I want the corresponding amount subtracted from the total. If they recheck the box, the amount is to be added. I want all records to appear on the subform even after unchecking them. This works fine...except......
1
4433
by: phaddock4 | last post by:
Being fairly inexperienced at Access 2000, i've been reading many posts here for the last several days, and testing myself to find the best approach to do the following in A2K: SET UP: I have created a MainTable (and related form), which has an associated SubForm (popup) along with its underlying, separate Table. The tables' relationship is one to many respectively. The primary key
5
4974
by: Mark | last post by:
Hi all, I'm completely new to access and am trying to create a simple form/subform. The main form will include: employee_number, forename, surname, total_leave, leave_remaining (to be calculated)
16
2453
by: ken | last post by:
I have a formA and subformB subformB is a continous form with a txtTotal in form footer =Sum() This works fine as long as there are records in form but if form is null I get Error I would like to get arround this as I Have a label to be Visible only if txtTotal>= 45000
1
3094
by: lawton | last post by:
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...
2
6491
by: post | last post by:
Sorry that this is rather basic. But I have tried the various suggestions given in this group and cannot get them to work. I have a main form, for simplicity called "Main". On it are two subforms. For simplicity subform1 and subform2. subform1 lists fees for items. The sum of all fees for all items is in a text box on the footer of subform1. PurSum =Sum(). subform2 contains exactly the same field, fees for items of a different...
16
34528
by: mlcampeau | last post by:
I'm fairly new to this so I'll try to be as clear as possible. I have a database that stores employee information and all job titles available. I have a main form that is based from a query and displays all job codes and job titles in the Job table. I also have a text box in the main form to keep track of the total number of positions available for this job title: =DSum("","","=!") Where JobVacancy is a table that contains JobCode, Department,...
1
1763
by: kickergirl | last post by:
I'm not sure my title actually describes my problem, but here it goes. I am creating a form to track account information for participants. Basically, a single participant can be offered up to $3,000 for the first year and up to an additional $3,000 for the second year. The main form tracks the dates the offers were made. And I have incorporated a subform to track the disbursements, whether for the first year allotment or second year...
7
9296
AccessIdiot
by: AccessIdiot | last post by:
This is driving me nuts. I have an unbound textbox (txt_SumSize) in my subform that holds the total of a field (Debitage_Size_Quantity)seen in datasheet view (control source =Sum(). I have an unbound textbox on my form (txt_SizeTotal) that gets the value from the subform footer when the form loads: Private Sub Form_Load() Me.txt_SizeTotal = Me!sbfrm_DEBITAGE_Size.Form! End Sub
0
8428
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
8341
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
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8630
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
7362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1740
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.