Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-12-18
4
Medium Priority
?
240 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 39

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
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 …

721 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