Click here to Skip to main content
15,868,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a somewhat elaborate import scheme for an instrument generated log file. Original structure and file naming are Access Unfriendly. My process involves, copying and renaming a set of 10 files, appending the 10 files a into a single file which is then copied to the import location, undoing a substantial portion of the original formatting, then importing to Access 2010. I have worked out each step individually and tested all steps for functionality. If I run the macro in single-step mode, everything functions as intended, but when I just let it run from start to finish, it skips the append/copy/overwrite function and loads the previously imported file again. The end result is an import that has been "de-formatted" twice and therefore corrupted. All appearances are that the file append/copy function fails to complete before the import kicks in. Is there a way to force/verify completion of one sub before the next runs?
Could a form timer be used to provide breathing room?

What I have tried:

I have tried inserting subs that address other issues along the way, in order to allow time for appending and copying of the target file. I have confirmed the desired result when single stepping through the macro.
Posted
Updated 15-May-18 10:47am
Comments
RedDk 15-May-18 15:39pm    
Try peppering your Subs with Debug.Print. That always worked for me. From within the Visual Basic Editor you'll be able to see the assigned variables printing the value in an iteration (Intermediate Window).

I'm surprised that no error messages at runtime have not begun to plague you.

1 solution

in vba there is a command called do events
look that up
 
Share this answer
 
Comments
Member 11520589 16-May-18 12:30pm    
Thanks ghinckley68! I'm a self taught rookie who's often in over his head. Once I figured out how DoEvents worked and how to make it work for me, it did the trick! Big thanks since the import process, with this particular dataset, has been a real butt-kicker.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900