Dear all,
I have a scenario that is driving me nuts. (MS Access 2003)
I have a form/subform (Continuous form) where it gets its data from tables Order and Order_Details.
In the footer section of the subform I have a hidden textbox named txtOrder_Total_ Amount which displays the total of the whole order. On the main form I have a bound contol from the Order table, namely Order.Order_Tot al_Amount_Euro
On the subform I have fields such as Product, Quantity, Unit_Price, Discount, Value_In_USD, Value_In_EUR. (certain Orders_Details are in USD whilst others are in EUR, but since I only care about EUR I calculate the exchange rate for all Order_Details that are listed in USD)
If the user changes the Product, Quantity or the Discount then the rest are modified on the exit event of each field. I then call the sub 'Update_Totals' which simply will refresh the txtOrder_Total_ Amount (found in the footer of the subform ) based on the Order_Details.V alue_In_EUR field
here is the code
Private Sub cmdUpdateTotals ()
' Refresh the Order_Total_Amo unt
DoCmd.DoMenuIte m acFormBar, acRecordsMenu, 5, , acMenuVer70
Immediately after this code, I have the following code (to populate the main form Order_Total_Amo unt_Euro field.
Forms!Order.Ord er_Total_Amount _Euro = Forms!Order.Ord erDetail!Order_ Total_Amount
End sub
I have made both the Order.Order_Tot al_Amount_Euro and the Order.Order_Det ails.txtOrder_T otal_Amount visible so I can view the results.
The problem is that although the code executes with no syntax errors (and I dont see any logic error here) and although the txtOrder_Total_ Amount is correctly updated, the main form Order.Order_Tot al_Amount_Euro updates sometimes with a delay and sometimes not at all.
Example.
Order_Detail 1. Quantity = 100, Product_Price = 10 EUR, Discount = 50EUR, Value_In_Eur = 950.
Order_Detail 2. Quantity = 200, Product_Price = 10 EUR, Discount = 150EUR, Value_In_Eur = 1850.
txtOrder_Total_ Value (in footer of subform) = 2800
Mainform.Order_ Total_Value_Eur o = 2800
If I change the quantity of the first Order_Detail record from 100 to 110 (and subsequantly the Value_In_Eur = 1050) then
txtOrder_Total_ Value (in footer of subform) = 2900
Mainform.Order_ Total_Value_Eur u = 2800.
It may update to 2900 after a certain delay or may not at all.
Now if I repeatedly clickand tab away on the Quantity field at some inconsisent point the Mainform.Order_ Total_Value_Eur u will eventually update.
Any ideas ?
Kind Regards
VirtualGreek
3 2412
Try changing this:
Forms!Order.Ord er_Total_Amount _Euro = Forms!Order.Ord erDetail!Order_ Total_Amount
To:
Forms!Order.Ord er_Total_Amount _Euro.Value = Forms!Order.Ord erDetail!Order_ Total_Amount
In the subform, put the following code in the OnChange event for the textbox that has computation of the detail total so that the mainformTotal will be recalculated.
Forms!Order.Ord er_Total_Amount _Euro.Recalc
Try changing this:
Forms!Order.Ord er_Total_Amount _Euro = Forms!Order.Ord erDetail!Order_ Total_Amount
To:
Forms!Order.Ord er_Total_Amount _Euro.Value = Forms!Order.Ord erDetail!Order_ Total_Amount
In the subform, put the following code in the OnChange event for the textbox that has computation of the detail total so that the mainformTotal will be recalculated.
Forms!Order.Ord er_Total_Amount _Euro.Recalc
Thanks puppydogbuddy. You pointed me to the right direction.
Take care!
VG
[color=black][size=3][font=Times New Roman]VG,[/font][/size][/color]
[color=black][size=3][font=Times New Roman]Forgot to tell you that you should replace this code line: [/font][/size][/color][size=3][font=Times New Roman]DoCmd.DoMenuIte m acFormBar, acRecordsMenu, 5, , acMenuVer70[color=black][/color][/font][/size]
[color=black][size=3][font=Times New Roman][/font][/size][/color]
[color=black][size=3][font=Times New Roman]With either this line:[/font][/size][/color]
[color=black][size=3][font=Times New Roman]DoCmd.RunComman d acCmdSaveRecord[/font][/size][/color]
[color=black][size=3][font=Times New Roman]Or this line:[/font][/size][/color]
[color=black][size=3][font=Times New Roman] Me.Dirty = False[/font][/size][/color]
[color=black][size=3][font=Times New Roman] [/font][/size][/color]
[color=black][size=3][font=Times New Roman]The DoMenuItem syntax is not used in access versions 2000 and higher. Please confirm that you got this message.[/font][/size][/color]
[color=black][size=3][font=Times New Roman] [/font][/size][/color]
[color=black][font=Times New Roman][size=3]Thanks. [/size][/font][/color]
Sign in to post your reply or Sign up for a free account.
Similar topics |
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......
|
by: Simon P |
last post by:
Hello group, I'm in desperate need of help. Here goes :
I have the following tables : CONTACTS (ContactID, FirstName,
LastName, Company, etc.), SHOWS (ShowID, ShowDescription) and
SHOWDETAILS (links the previous tables together so not to have a
many-to-many relationship -- has the ContactID and ShowID fields).
I have a main form with a couple of listboxes which are used for
querying the CONTACTS table. The results populate bound fields...
|
by: Cro |
last post by:
Dear Access Developers,
I am developing a form with 'default view' set to "continuous forms".
I am suffering with a problem I can't yet see a solution too.
Each record has many fields. Two fields I would like to add a little
extra functionality to are a check box and a combo box. More
explicitly, I would like the 'enabled' property of a combo box control
to be dependent on the value of a check box (a 'yes/no' field) in the
same...
|
by: Galina |
last post by:
Hello
I have an application in MS Access 2K.
A form contains 2 subforms. Each subform is based on it's own table.
One table contains a field Total. Another one contains a field Points.
The field Total is a sum of Points in several records. Before to open
the form, Totals are pre-calculated.
Users enter points into the column Points via one subform. I want to
reflect the change in points summary in another subform. To do so, I
have a...
|
by: Dave Boyd |
last post by:
Hi,
I have two very similar forms each with a subform. The main form gets
a few fields from the user and passes this back to a query that the
subform is bound to. The requery is done when the user enters the
last qualifying field on the main form.
In one case this works fine, the subform shows the data the user wants
to update -- which means showing all the data put in previously (ie
showing this via the requery and the continuous...
| |
by: Kathy |
last post by:
What is the standard technique for handling the fields in the following
scenario on a continuous form?
Multiple Divisions. Each Division has multiple Buildings. Each Building has
a Supervisor.
Tables: (abbreviated)
TblDivision
DivisionID
|
by: kaeldowdy |
last post by:
This one is stumping me!
I have a Form/Subform arrangement. The main form is set as a Single
Form and the sub form is set as Continuous Forms.
On the Form_AfterUpdate event of the subform, I run some code that
affects the main form which forces focus *away* from the subform and
puts it to the main form.
I need to keep focus on the subform when the code in the
|
by: ApexData |
last post by:
I have a Continuous SubForm on a TabPage.
Above the ContinuousForm is a "box of fields" I use to display the
entire record that the focus is on. When one points to a record using
the RecordSelector, it has the desired effect of displaying all the
fields for one record.
I use buttons New/Edit/Del, and changes are made in the box.
I need to Disable the ContinuousForm while changes are taking place in
the box. If I set the...
|
by: Steve |
last post by:
Is there a way to put a main form/subform in a continuous form so I can
scroll through all the records in the main form?
Thanks!
|
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...
|
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,...
| |
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...
|
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...
|
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,...
|
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...
|
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();...
|
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...
| |
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...
| |