Solved

Access - Tabbed Form - Requery works if Step Thru.  Errors if Run without Step Thru

Posted on 2013-02-06
5
308 Views
Last Modified: 2013-02-06
Hello All

I have a Strange Thing Happening.........  At least to me it is.........

I have a Tabbed form with each Tab having a Subform Control on every tab....

One of the tabs has a Subform with 6 of its own Subforms.  On the 6 subforms (all Single View) there is an unbound field where I calculate some info.  

Info from those 6 Subforms via Vb code gets used in some other Tabs Subform Controls.

The First tab of my form has an Unbound Textbox where a user inputs one piece of info.  That starts all of the computation via my After_update event of that textbox.

Now then, If I don't put any Breaks in my code it errors out when getting the Computed field from one of those 6 subforms.

HOWEVER, if I put a Break in all the code just before the line where it errors and then step through everything line of code line by line it all works............it is as if just running it happens too quick for those subforms to internally update before the code to get the info for the other forms processes........

Is there a solution to this???????
0
Comment
Question by:wlwebb
  • 2
  • 2
5 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 450 total points
ID: 38858888
What is the exact error?

Stepping through things in the debugger slows the code execution down... which may allow anything happening outside of the current block of code to run to completion.

Just for kicks, try adding a messagebox statement immediateluy before whatever line is causing the problem.

Also try adding the following immediately before the problematic line of code:

DoEvents '<-- this causes a pause to allow other things to complete


You can even put DoEvents into a loop to wait for something specific to happen.  For example, if the error is caused by a Null in some field:

Do Until "" & [SomeThing] <> ""
      DoEvents
Loop
' The rest of your code

Open in new window

0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 50 total points
ID: 38858955
I was looking at your other question, and my guess is that the problem here has to do with you returning a recordset with zero records.

I think you need to address your perceived need for this subform which contains 6 other subforms, and the data you are collecting from those subforms.  Is there not an easier way to compute these sums than through 6 subforms?

Otherwise, you need to add the same test in the code for this issue that you did in the other question.
0
 

Author Comment

by:wlwebb
ID: 38859454
Mbizup

Wow that did it..........  ??????????????? Don't understand why????  other than it is processing faster than the update of the form can complete......

Fyed

Unfortunately I've reworked this a few times already trying to eliminate the need for the 6 Subforms....  I have not yet found a way to do that.  The info input on the main form that fires all the code selects which of the 6 subs get completed so that if a sub is not applicable it does not create any record for that type..... not even a record with a 0 in the amount field.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38859495
--->> other than it is processing faster

That's pretty much what is happening.

You have other events and 'stuff' going on with the various subforms.  The quick fix is through code (delays) ensure that all the 'other stuff' has time to complete before trying to do something that is dependent on it.

The best fix, of course is to streamline your forms, etc as much as possible to avoid these types of conflicts.
0
 

Author Closing Comment

by:wlwebb
ID: 38860317
Thanks Mbiz.... I am awarding Fyed 50 of the points because he does make a valid point within the discussion.  Thank you both.  

JUST FYI Fyed

I am pulling that code apart (again) to see if there is another way using the DAO recordset method that I can write....... and make mostly work..........  so.......I'll probably post some more that looks similar just trying to do it without using the Subforms again........

In that vein, is there a way within code to create a combobox without physically putting it on and having it update through the Subform ???   Likewise a query????
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question