|
-
Feb 15th, 2006, 02:31 PM
#1
Thread Starter
Lively Member
Help!! Access database sql queries
Hi all
I know this should be easy but it's really baffling me.
I've written some code which uses ADO to send SQL statements to my database. The first procedure DELETEs records from tableX, then calls another procedure which updates tableY with data imported from a text file'. Finally, execution returns to the first procedure which 'INSERT .... SELECT's all the information in tableY into tableX.
The problem is the final 'INSERT .... SELECT' doesn't always work. It's almost as though the tableY updates happen too fast, because if I break the execution after the second procedure and then continue it, the final 'INSERT .... SELECT' always works!!
I've tried included rs.begintrans and rs.committrans but that doesn't help. The success of the final 'INSERT .... SELECT' seems to be unpredictable BUT I'm sure there's an obvious explanation.
Unfortunately, I haven't got the code here, as it's for something I'm doing for someone else but can anyone offer any advise, clues or guidance.
As ever your comments and help would be much appreciated?
Pobo
-
Feb 16th, 2006, 08:36 AM
#2
Re: Help!! Access database sql queries
If it is timing, put a couple of doevents after the import line.
In theory the import should complete before the inserts start. but maybe they don't.
Or alternatively there is a delay in writing the import to the tables so when the select into runs it misses all/some of the data.
If the latter case, have a search through the forums for rdo. Or JRO.Refreshcache - which should force access to write all changes. Test/read up and see?
Last edited by Ecniv; Feb 16th, 2006 at 08:42 AM.
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|