473,699 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sum() problem on ADP subform

Br
I'm sure this has been answered before but I can't dig up any posts that
give a good answer.. and I'm sure I've come across it before but forget how
I dealt with it.

I have an ADP (A2000, SQL2000). I have a form with a linked subform. The
subform list expense records and there is an unbound calculated textbox in
the form footer to Sum() the amounts. It works fine if the subform is
brought up by itself, but when it is used as a subform it displays #error.

It also used to not work when the subform was brought up by itself but I
worked out it didn't like another total textbox I had (I changed
=Sum([Amount]/12) to Sum([Amount])/12 to fix it). I have since removed all
other total textboxes so only the simple Sum() is left.

I could try and do the summing on the SQL server but I need the resulting
recordset to be updateable.

Since I only need the simple sum() (all others totals are derived from this
figure) I could just call a SP on the main form to get this total after an
update to the expense records is made... I don't like this approach but if
it works I guess it's the way I'll have to go.

Thoughts?
--
regards,

Br@dley
Apr 11 '06 #1
7 3240
Br
Br@dley wrote:
I'm sure this has been answered before but I can't dig up any posts
that give a good answer.. and I'm sure I've come across it before but
forget how I dealt with it.

I have an ADP (A2000, SQL2000). I have a form with a linked subform.
The subform list expense records and there is an unbound calculated
textbox in the form footer to Sum() the amounts. It works fine if the
subform is brought up by itself, but when it is used as a subform it
displays #error.
It also used to not work when the subform was brought up by itself
but I worked out it didn't like another total textbox I had (I changed
=Sum([Amount]/12) to Sum([Amount])/12 to fix it). I have since
removed all other total textboxes so only the simple Sum() is left.

I could try and do the summing on the SQL server but I need the
resulting recordset to be updateable.

Since I only need the simple sum() (all others totals are derived
from this figure) I could just call a SP on the main form to get this
total after an update to the expense records is made... I don't like
this approach but if it works I guess it's the way I'll have to go.

Thoughts?


ps. If I click on the subform and press Shift-F9 the totals appear. But as
soon as I move off they return to #error
--
regards,

Br@dley
Apr 11 '06 #2
I asked Access to generate two auto-forms and added the totals control
as you describe, mine being =Sum([TotalAmount])/12. The error does not
occur. (Acc 2003, MS-SQL 2000)

Is it possible that you have some control, object, property, field
associated with the main form called Amount?

Apr 11 '06 #3
Br
Lyle Fairfield wrote:
I asked Access to generate two auto-forms and added the totals control
as you describe, mine being =Sum([TotalAmount])/12. The error does not
occur. (Acc 2003, MS-SQL 2000) Is it possible that you have some control, object, property, field
associated with the main form called Amount?


Nope. I thought of that.

Ok, I think I found the problem.

I have some code that calculates values based on the total expenses. I
issued a subform requery before the calc to make sure the data is saved. So,
it seems to be a timing issue (the same old thing in ADPs). The recordset
and calculated field aren't populated in time before they are used in the
calcs.

I don't think I need the requery.. but will have to test more to make sure
the calc work properly.

Thanks.
--
regards,

Br@dley
Apr 11 '06 #4
"Br@dley" <do***********@ google.com> wrote in
news:e1******** **@news-02.connect.com. au:

I have some code that calculates values based on the total expenses. I
issued a subform requery before the calc to make sure the data is
saved. So, it seems to be a timing issue (the same old thing in ADPs).


I'm glad I'm young and fresh; I've never met that old thing. Why would this
create an error? The wrong answer maybe ... but an error?

--
Lyle Fairfield
Apr 11 '06 #5
Br
Lyle Fairfield wrote:
"Br@dley" <do***********@ google.com> wrote in
news:e1******** **@news-02.connect.com. au:

I have some code that calculates values based on the total expenses.
I issued a subform requery before the calc to make sure the data is
saved. So, it seems to be a timing issue (the same old thing in
ADPs).
I'm glad I'm young and fresh; I've never met that old thing.


It's the same issue you get when you requery a form and try to search the
recordset and only the first 100 records or so are available to be
searched...
Why
would this create an error? The wrong answer maybe ... but an error?


No idea. Perhaps you can duplicate it and see:)
--
regards,

Br@dley
Apr 11 '06 #6
You're familiar with the solution posted to the general problem (not
yours) at
http://groups.google.ca/group/comp.d...8?dmode=source
?
Can you do something similar?

Apr 11 '06 #7
Br
Lyle Fairfield wrote:
You're familiar with the solution posted to the general problem (not
yours) at
http://groups.google.ca/group/comp.d...8?dmode=source
?
Can you do something similar?


My issue wasn't OnOpen but after a requery and then trying to reposition the
current record back to what it was (ie. mimmick a Refresh in an MDB). It's
the same cause though.
I reset the Recordsource of the form (Create RS, find record, then set
Me.Recordset = rs). This worked great, all records were returned "in time",
but my find wouldn't work at all anymore. I fixed this by using Set rs =
Me.Recordset.Cl one instead of Me.Recordsetclo ne.

Back to my current problem... I guess I could reset the RecordSource but it
seems that the Requery wasn't needed anyway....
--
regards,

Br@dley
Apr 11 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
7967
by: U N Me | last post by:
I have a continuous form that lists records from a query. One of the columns is an amount field, In the footer of the form I place a text box that displays the total (sum) of the amount. The data in the form is linked from a one-to-many table relationship. In this instance, I really can't sum the value from the one's table since if there were 3 records in the many table for a record id, the value would be summed 3 times. IOW, I may be...
2
2195
by: AccessHelp32 | last post by:
Hi All, I have a subform attached to a main form in which both forms are linked through a Project ID field. When I change the Project ID field on the main form, only the records associated with the Project ID are shown on the subform. I would like to sum a field in the subform and display that sum on the main form (perhaps in the footer). However, I want the sum of the subform fields to be only for the Project ID field shown. Any...
2
3005
by: apartain | last post by:
In the detail of my report I am extracting a sum from a hidden subform via the following: =IIf(.Report.HasData=True,.Report!Text19,0) Where Text19 is the sum of the items in the subform. I also need a grand total of the Text19's, but because of the conditional statement in the field recieving the result, I can not simply sum them up at the bottom of the report,so I created another subform in my report footer with the exact data, also a...
1
3100
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...
14
1868
by: David Grist | last post by:
Hello, Any help would be appreciated!!! I need to sum AMOUNTTEND on a receipts subform that meet a certain criteria. It has to be something like. =sum() where ="tour installment"
2
2119
by: Andreas | last post by:
Hello together, I want to calculate a sum in subform from a subsubform (sounds complicated?) but I get an #error but... see below My database: I have a main form with members, each members has in a subform from 0-x projects (in the subform) each project can have from 0-x subprojects with working days.
4
8259
by: csolomon | last post by:
Good Morning, I am trying to get the sum of values on a subform, that is a continuous form. The name of the main form is : F_MixDesign Subform is : SF_MixSample Subform control name is: DM_Yield the text box that I am storing the value in is an unbound text box.
24
6478
by: bkberg05 | last post by:
Hi - I have a form called mainForm that has a subform called subForm. The subform has a numeric field called subCost. There are many subForm records for every mainForm record. On the main form, there is a field called mainCost. Whenever someone makes a change to the subCost field, I want to populate the mainCost field with the sum of the subCost values. The mainForm and the subForm are joined by mainID = subID. Here is my lame...
0
9174
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
9034
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
8914
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
8883
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...
1
6534
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5874
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
4376
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...
1
3057
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
3
2009
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.