Docmd.runSQL with Access 2000 runtime

I am having troubles running a "docmd.runsql" statement on a machine with the Access 2000 runtime version installed.  The statement (and code) works fine on any machine with full Access on it but shuts down the database on my runtime machine.  The command looks like:

DoCmd.runSQL sqlstring

The "sqlstring" is a delete command something to the effect of "Delete * from  tblTableName ..."

The interesting thing about this ( to me anyways) is that it doesn't give a error message.  It pops ups a window with the message "Microsoft Access for Windows has encountered a problem and needs to close.  We are sorry for the inconvenience." and gives the option to send or not send a notification to Microsoft.

Is this an error with just that copy of Access Runtime or should I go about this delete a different way for my runtime machines
UDRCprogramerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ArjiCommented:
It should work the same but that error may indicate a corruption in the app.  Try compact and repair to see if that helps.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jim HornSQL Server Data DudeCommented:
Couple of possibilities...
(1)  The SQL of the query you're trying to delete is incorrect.
(2) Try placing DoCmd.SetWarnings False before the line, and DoCmd.SetWarnings True after it.  This will get rid of the "You are about to delete some records" msgbox.
(3)  The table you're trying to delete from is read-only as another form/recordset has it locked up.
kirenievsCommented:
Do you have a good error handling routine in the procedure. It's crucial workong with runtimes.

All procedures should have somthing like this

Privat Sub YourProcedureName()

On Error GoTo Err_YourProcedureName

.....

Your code here


Exit_YourProcedureName:
'Eventually some cleanup here like Docmd.setwarnings True etc
Exit sub

Err_YourProcedureName:
msgbox Err.number & ": " & Err.description
resume Exit_YourProcedureName

End Sub

This is a very simple variant. It's important with the resume after an error has occured. The simplest error handling of them all is On Error Resume Next in the top, but then you will never see any errors. That will make it difficult to find unknown error.
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

ArjiCommented:
kirenievs has a very good point.  There is a free utility for Access called MZ Tools, http://www.mztools.com that will add error handling code to your procedures.  It can even be customized to add what you want it to.  I use the freeware version of it and it's a great add-in.
kirenievsCommented:
Good tip. Today I do all the typing myself and that I sometimes (too often) do not do proper error handling. So I sure will try this.
ArjiCommented:
It does a lot more than just error handling code.  Be sure to check out the templates so it will insert the kind of code you want.  I modified the error handler template to add what you posted above.
UDRCprogramerAuthor Commented:
I appreciate everyones input.  It turns out that the simplest solution was the one that worked (compact and repair).  I did, however, go back a tighten up my error handling.  EE has once again prevented a headache with a simple solution, best $10/mo. I ever spent.  Thanks again everyone...
Jim HornSQL Server Data DudeCommented:
>best $10/mo. I ever spent.
We may refer some other individuals to you whom often believe that $10/month should buy them complete solutions, on-demand, without criticism.  :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.