Solved

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

Posted on 2013-12-18
4
219 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 35

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

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 …
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…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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 …

856 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