473,804 Members | 3,822 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using subtotal pulled from subform in calculations on main form

9 New Member
I have a subform that totals a subtotal in the form footer. It works fine. I then pull that value onto the main form into a textbox called Subtotal2 by setting the control source =OrderSubform.F orm!Subtotal and it seems to work fine.

When I try to reference the Subtotal2 text box to perform calculations on it it doesn't work. For instance when in vba I set Me.tax = Me.Subtotal2 * TaxRate I get zero. I tried just saying Me.tax = Me.Subtotal2 to see if thats where the problem is and it is still zero. If I change it to Me.tax = 50 it comes out as 50 so I know the code is executing. Any ideas? The Subtotal2 box displays the correct subtotal but the vba code seems to think it is zero.
Oct 21 '09
12 4312
etmanage
9 New Member
I found how to delay the code from executing and delayed it .1 seconds and that fixed it. Thanks for helping out.
Oct 23 '09 #11
NeoPa
32,579 Recognized Expert Moderator MVP
@etmanage
That all sounds very weird and unexpected. I overlooked the rest of your post earlier I'm afraid. I'll look more deeply into that. It may not be as strange as a delay that's needed.
Oct 23 '09 #12
NeoPa
32,579 Recognized Expert Moderator MVP
It looks as you say like the .Requery method from the previous line returns control before all the associated items have been updated.

I would think waiting for a second would be too long though. I've played with this quite a bit and checked the Help system (can be quite useful although can also be frustrating at times) but it doesn't seem this is included anywhere. I wanted to find a way to check that the data was available before proceeding, but nothing I tried worked.

Eventually I thought the best way (if it doesn't have problems for you, unrelated to what we've discussed) would be to set the .ControlSource of [Total] to =[Subtotal2]. I hope this is some help. I admit to being stumped on finding a logical way for the assignment to work in VBA.
Oct 23 '09 #13

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

Similar topics

1
3585
by: Txsg8r | last post by:
I have a main form with a subform on it. When I click a button on the main form, I perform some calculations on data contained in the subform's table (all related records actually). However, after the data is massaged, I refresh it, which takes me to the first record on the subform. Instead, I need to return to the record I had showing on the subform when I clicked the button on the main form. Example: Customer= Main form. Orders =...
3
5884
by: Charlene | last post by:
I have an Invoice/Invoice Details form/subform. In the page footer of the Invoice Details subform I have a textbox with the control source set to =Sum(). I then pull this value into the main form with a textbox whose control source is =!. This works fine when there are one or more line items in Invoice Details but on a new invoice before any invoice details are entered, the textbox on the main form shows #Error. I would like it to show...
1
4445
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
3
2760
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality (we're sales offices, and I'm doing things such as associate directories, commission calculations, order tracking, etc.). 2003 seems to have a few extra features, but I seem to continually run in to oddities that seem like they SHOULD work, but...
3
1931
by: panwala_bhavesh | last post by:
I have a subform in continuous form style that I use to populate 3 fields (textboxes) on my main form with a double-click of the key-field textbox of the sub: Private Sub TextBattID_DblClick(Cancel As Integer) Forms!. = Me! Forms!. = Me! Forms!. = Me! End Sub
0
1697
by: robert.waters | last post by:
Hello, Say that there is a database for client information; there is a main form that displays the client's name, and this form has one or more subforms that display different types of information related to that client. The main Form has RecordSource="SELECT clientid, clientname FROM client_table;", and each subform has both Link Child and Master Fields="clientid".
5
3240
by: vsteshenko | last post by:
Hello, This is my second post to the any usernet group and the first one was posted to the wrong one. I am currently working on creating an order form for sales associates at my work to be used at conventions. I have a main form with two subforms. On the main form, there is a text box that displays the sum of total orders entered in the subform, . I'm trying to create another text box on the main form, that looks at the subtotal...
3
2236
by: xian2 | last post by:
Hi All, I am trying to create a subtotal text box much like the one in the orders form of the northwind database where you have a subtotal text box in the footer of the subform and then have that displayed as a text box in the main form. However, I am having difficulties in doing this and keep getting #Error or #Name? displayed in it. Any Ideas would be much appreciated. Background info: Form = Tours
1
3108
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...
0
9706
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
10577
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
10332
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
10320
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,...
1
7620
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
5521
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...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
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.