Question Error Handling in VBS

grifter

Registered User.
Local time
Today, 11:11
Joined
Sep 23, 2011
Messages
45
Hi

I have a VBS script that runs a query in my Access DB. Now and again the query raises error to say DB or object is read only and I am sure this is because maybe someone is touching the sharepoint the table in the query is linked to - despite them knowing it should not be touched during process time.

What I would like to do is have some code in VBS script that does basically this:

run the query
if error = 3027 then
run the query again
if error still there go back to run the query again.

But using error trapping how do I use this in combination with a loop to rerun until the read-only error doesn't happen?

Thanks

G
 
How do you run the query?
Why does it return an error?
Can you show the commandline?

Instead of just running the query run VBA code instead.
Let VBA run the query and trap the error.
Better yet, let VBA check the environment so the error does occure then run the query.

HTH:D
 
Are you actully using VBS or are you using VBA? They are two different (although not much) languages.
 
Are you actully using VBS or are you using VBA? They are two different (although not much) languages.

Using VBS

and using
Code:
While err.number = 3027
err.clear
docmd.runquery("MyQuery")
Wend loop
It seems to keep going back into the loop with the error and clearing some records each time it loops but not all, however if there is a lock on the records in the sharepoint then I thought it just failed not cleared some records. Found that on other occasions it would clear all the records but keep looping with error and the sharepoint still looked as if the record lock/conflict was there until you refreshed the browser.

G
 

Users who are viewing this thread

Back
Top Bottom