Solved

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

Posted on 2013-12-18
4
225 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
[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
4 Comments
 
LVL 37

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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…

710 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