?
Solved

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

Posted on 2013-02-06
5
Medium Priority
?
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 1800 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 48

Assisted Solution

by:Dale Fye
Dale Fye earned 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

765 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