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
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?