473,608 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem disappears when I step through code

Jan
Hi:

I've been tearing my hair out over this one for a few days; did a search
of the archives and found similar questions but no real answers. Here goes:

This is an application for a retail store. There are transactions,
transaction details, and then, depending on the type of detail, related
records in other tables. So when I'm entering a new transaction, I open
a new form (dialog mode) in which additional detail is entered. I need
to bring the total fee for that detail back to the main form. Please
don't tell me to use subforms; they don't work for this application.

Here's the problem:

The form I call [repair dialog] has a calculated control called
totalamt, which holds the total of the the various parts of the repair
(might be several sub-records for each type of repair). This total
needs to go back to the main form (transactions), in two places:
transAmt (amount for this transaction) and finalAmt (which is only
entered if the transaction is to be completed--they price some
transactions that the customer might not accept).

When I'm closing the repair dialog, I have the following code in the
on_close event:

[Forms]![Transactions]![transDetailSub].[Form]![transAmt] =
Forms![repair dialog]!totalamt
If Forms!Transacti ons!transDetail Sub.Form!transT ype <>
"suggested repair" Then
[Forms]![Transactions]![transDetailSub].[Form]![finalAmt] =
Forms![repair dialog]!totalamt
End If

When I just close the repair dialog, this code does not run properly; it
transfers $0 to the main transaction form, instead of the correct
calculated amount. However, if I step through the code to see where
it's failing, it works just fine. If I put the break at the If
statement, then the second part works fine but the first part still
returns $0.

Here's what I've tried:
copying the total to a global variable first
running the code in another part of the process (every time a line is
updated, for example--way too heavy on resources and it fails anyway)
sticking in some DoEvents (but since I'm not really solid on how they
work, I may be doing that wrong)
inserting the calculation (the source for totalamt) instead of the
field totalamt

The search I did suggested that calculated controls are a low priority
for Access so it does them last, after other actions. But I don't know
how to address this problem (that's what the doEvents were supposed to
do, I guess).

Ideas?

Thanks.

Jan
Mar 10 '08 #1
1 1549
On 10 Mar, 17:06, Jan <j...@dontspamm e.comwrote:
Thanks, but the code fails even when nothing has been changed; if I even
open the dialog and close it again, it overwrites the numbers to $0. So
saving the record appears not to be the issue.

Anyone else have ideas?
Your code suggests that you are using subforms. It appears that the 2
total fields, transAmt and finalAmt, are inside a subform control,
'transDetailSub '.
If this is the case, I would check that the 'Link Child Fields' and
'Link Master Fields' of the subform control are what you expect (See
the Data tab of the subform control's property sheet. Presumably, the
Master should be set to the value of the 'Transaction ID' which is the
primary key of the 'Transactions' table and the Child should be set to
the foreign key 'Transactions ID' in the 'Transactions Details'
table.

Mike P
Mar 17 '08 #2

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

Similar topics

3
2308
by: ThunderMusic | last post by:
Hi, I'm trying to have a MSN Messenger like form/app closing behavior. When I click on the X button, I only want the form to disappear and when I double-click on the notify icon or right-click on it and choose Open from the context menu, I want the form to reappear. For that, I got the point covered. Even when the form is minimize, the behavior is like MSN Messenger. But one problem arose. When I close the form (the first time), it...
7
2046
by: pk | last post by:
Here is my code, and it's not working. Please help me get through this. I've read every single tutorial and you may even see remnants of some of their variables in my code. I don't know if I'm close, but I feel that I'm getting there. Thanks in advance for any help. I much appreciate it. -pk <SCRIPT>
6
1425
by: Ubi | last post by:
hi i have a problem with System.Data.DataViewRowState. i have a ReadOnly datagrid, a dataView and a dataTable. i'm using the dataView's filter property to filter the data (firstName = 'Dani'). the problem is that i don't understanh how the ViewRowState works: i have an external form that changes the value of the dataTable.
39
3030
by: jcrouse | last post by:
I am using the following code to get a background image for my form Private Sub mnuBgroundImage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuBgroundImage.Clic If OpenFileDialog1.ShowDialog() = DialogResult.OK The Dim sr As New System.IO.StreamReader(OpenFileDialog1.FileName Me.BackgroundImage = Image.FromFile(OpenFileDialog1.FileName sr.Close( End I End Su
12
5122
by: Joel Byrd | last post by:
I'm having a little problem with using type-ahead functionality for an auto-suggest box. Sometimes, when I start to type something and the type-ahead shows up, the AJAX will send a request query using the value that *includes* the type-ahead value. In other words, say that I type in "ja" and the first listing that comes up is "jack@test.com". The AJAX part is supposed to send "ja" as one of the query string variables when calling the...
39
19606
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1) What's the difference between these 3 statements: (i) memcpy(&b, &KoefD, n); // this works somewhere in my code
0
1136
by: Kevin | last post by:
I purchased an ActiveX control from someone a few years ago. It's a checklistbox. It's works kind of quirky in my VB2005 Windows Forms app. They have a new version of the checklistbox that I just got from them. It was created in May 2005. When I open my program now, it bombs out and just disappears. When I open it again I get the message: "An error was encountered while opening associated documents the last time this solution was loaded....
5
3523
by: H J van Rooyen | last post by:
Hi, I am struggling to get the pack method to do what I intend. I am trying to display user input in a seperate window, along with a little description of the field, something like this: Current entry Company : entered co. name First entry : entered stuff The second entry: more entered stuff
22
4310
by: b_r | last post by:
Hi, I'm trying to make a simple operation (insert into DB) in VB 2005 and SQL Server. The code is as follows: Dim sConnectionString As String = _ "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DB.mdf....
0
8000
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
8495
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
6815
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...
1
6011
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
5475
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
3960
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
2474
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
1
1589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1328
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.