Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange behavior: "runtime" vs. Step-by-step

Status
Not open for further replies.

LRHatBSSS

IS-IT--Management
Dec 22, 2005
17
0
0
US
Hello all:

I have i three-level form destined to control cos acounts. In a simplifications the tables in use are Firm, Accounts and Account-Entries. The tables have relations ships as: One Firm has many Accounts, which may have many entries, all based on foreign key (sorry if this is TMI, but I just want to clarify the situation).

The forms structure is, basically:
|_________________________________________
| Form Firms |
| _______________________________|
| | Subform Accounts |
| | |
| | _________________________|
| | | |
| | | “Sub”Subform Entries |
| | | (Continuous) |
| | | Field Individual_Entries |
| | | |
|__________|_____|_________________________

Individual_Entries on SubSubform Entries are totaled to Total_Entries (unbound, =Sum(individual_entries)). After me.recalc I transfer the values to the upper level forms through collection syntax (Forms!Form_Firm… = Total_Entries).

Finally my problem (thx for the patience): When I run the form normally, meaning, I open the form and input entries, the , me.recalc function seems to make the form “spin” for a while cycling and the upper level fields are not updated. However, if I place break points and manually (step-by-step) debug the routine, it works without problems, no “spinning” and the upper level fields are correctly updated.

Ideas? Suggestions?

Any assistance is welcome and appreciated.


L.R. Humberto

If you don't know where you are going to, doesn't matter how fast you are going, you'll never get there.
 
Have you thought about trying some error trapping, or using some conditional statements to try and avert this mishap?

On Error GoTo HandleErr




HandleErr:
MsgBox Err.Number & " " & Err.Description

....

Then, go back and see what is causing those errors (if any), and add in conditional code if need be to correct for them - or else fix whatever other problem is causing the "spinning".

I would also think that you might have something looping too much in your function, possibly, and that coudl possibly cause the problems. If you are, for instance, working with a recordset of a table, but the table is really huge, maybe you should try running some SQL as apposed to the recordset.

Any help from this?

Also, if not, or if this is just part of the way, maybe try posting the code that is running when your form is "spinning", and we can take a look at it to see if we see anything possibly amiss.
 
KJV,

Thx for your posting.

However, i'm still at a loss:

- No error happens. At least, errors that could be trapped.
- The tables have only test records at this point (just a few dozens)
- I reduced and eliminated everything else. I wnet back to the proverbial drawing board. There are only two levels now (form - subform). One field in the main form, that shoul receive the total from the subform total. On the sub form just three fields: description, amount and the totalization.
- The only event trap has the following code behing it:

Private Sub Ctl5471_Description_GotFocus()
On Error GoTo Err_Ctl5471_Description_GotFocus

Me.Recalc
Forms!frm_MyMainForm.Controls!TXT_Entries_TotalMain = Me.TXT_Entries_TotalSub

Exit_Ctl5471_Description_GotFocus:
Exit Sub

Err_Ctl5471_Description_GotFocus:
MsgBox Err.Description
Resume Exit_Ctl5471_Description_GotFocus

End Sub

- me.recalc seems to be the culprit. when i click on the description field the form flickers (like is being refreshed multiple times - what i called "spinning"), but the only field that should be recalculated is the subform subtotal.

- I searched around and (in another site) i found somebody else with similar problem. He solved the issue passing the value to an unbound field in the main form AND to the original bound field. But it does not explain the reason and if it is a bug i would like not to leave the system with a time bomb inside it.

L.R. Humberto

If you don't know where you are going to, doesn't matter how fast you are going, you'll never get there.
 
You may try to replace this:
Me.Recalc
with this:
Me!TXT_Entries_TotalSub.Recalc

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

Thx, for your posting.

Actually i even tried Me!TXT_Entries_TotalSub.Requery (.Recalc method do not apply to text boxes). However .Requery is not the best solution as i do not want to refresh / requery the whole form, but just recalculate the one field in the subreport. And, the worst part, the field in the main form was always one update behing.

It just do not make any sense for me. I'm pretty sure there is a bug somewhere.



L.R. Humberto

If you don't know where you are going to, doesn't matter how fast you are going, you'll never get there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top