Solved

vb. 4.5  code "skips same line" when not attached to file for debugging

Posted on 2013-12-18
4
207 Views
Last Modified: 2013-12-27
I am doing a simple update of two tables in Access 2007 after I open a form on a button click event.  The routine  updates table 1, and I call a separate sub to update  table 2.  When the code runs it updates the first table but ignores the second update sub.

Originally I had both update actions in the same sub, ran into this problem and created two separate subs to see if it would help.

When I attach the form to the vb code to debug it, everything works 100%.  I can F10 through the code, table 1 updates, the second sub fires and updates  table 2.

I then put in message boxes to try and debug this without attaching the file. To my surprise, each message box showed up and the table 2 updates.

I rebooted the system, cleaned up the disk, etc  and the code still doesn't update that second table except when I attach the file and F10 through the code

This is bizarre behavior and costing me hours of agony.

Any Ideas?
0
Comment
Question by:BROOKLYN1950
  • 2
4 Comments
 
LVL 34

Expert Comment

by:PatHartman
ID: 39727941
Post your code please.

OOPs.  I just noticed that this is actually a .net question.  I would suggest a .net forum instead since this is an Access forum.  You may be using Jet or ACE to hold your data but you are not using Access.
0
 
LVL 20

Expert Comment

by:GrahamMandeno
ID: 39728830
It seems clear this is a timing problem.  Have you tried putting a delay (sleep) in the code before the attempt to update the second table?  Even so, such a solution would be kludgey and unreliable.

It's hard to guess what the problem might be without seeing your code.  Certainly dividing one sub into two would make little difference as the second would run directly after the first without delay.  

I am guessing the second update action relies on changes made to another table in the first update.  If so, is there a way to rephrase the SQL (?) for the second update so it includes the changed values in the first update and does not rely on these being in the table?

Best wishes,
Graham Mandeno [Access MVP since 1996]
0
 

Accepted Solution

by:
BROOKLYN1950 earned 0 total points
ID: 39735280
Thank you for trying to help.  I finally debugged it.  I had a dialog result at the end of the sub bur\t I was calling the form from a sciript file and so the process shut down before it could execute the update
0
 

Author Closing Comment

by:BROOKLYN1950
ID: 39741502
Only one comment came in and I had solved it before that came in
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now