473,480 Members | 3,021 Online
Bytes | Software Development & Data Engineering Community
Create 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!Transactions!transDetailSub.Form!transType <>
"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 1540
On 10 Mar, 17:06, Jan <j...@dontspamme.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
2296
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...
7
2031
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...
6
1416
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 =...
39
3009
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...
12
5102
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...
39
19550
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)...
0
1120
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...
5
3511
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: ...
22
4288
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...
0
6920
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...
0
7060
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,...
0
7106
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...
1
6760
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...
0
7022
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...
1
4799
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...
0
3013
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...
1
572
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
206
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...

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.