Link to home
Start Free TrialLog in
Avatar of c9k9h
c9k9h

asked on

Error coding around delete statement

On Error Resume Next
    DoCmd.DeleteObject acQuery, "qry_FilteredRecords_GSS"
    DoCmd.DeleteObject acQuery, "qry_FilteredRecords_GPC"
On Error GoTo 0

This used to work.  But it stopped and I don't know why.  Please help!
Thank you.
Avatar of jefftwilley
jefftwilley
Flag of United States of America image

nothing wrong with the commands. If the queries exist, it should delete them..if they don't, should error.

you didn't mention any errors...so maybe you should take your Resume Next out and go ahead and capture the error and see what it's saying.

If it's a system error...make a backup now.

J
On Error Resume Next
    DoCmd.DeleteObject acQuery, "qry_FilteredRecords_GSS"
    DoCmd.DeleteObject acQuery, "qry_FilteredRecords_GPC"
MsgBox Err.Description
On Error GoTo 0

Try above to see what the error is.
try taking the commas out
ASKER CERTIFIED SOLUTION
Avatar of jefftwilley
jefftwilley
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Mike ... what doesn't work ... ?

xm
n'er mind on the comma thing... the commands are fine.
Avatar of c9k9h
c9k9h

ASKER

I do get an error message that says the queries don't exist.  And they don't.  That's why I need the code.  I will build them later on with SQL.  However, I'm having a problem with 'too few paramters' that I'm working on, so the code doesn't get far enough to rebuild the queries.  And it's driving me crazy to keep getting the annoying error that they don't exist.  Is there another way to code around it?  Like I said, it used to work . . . I don't know why it stopped.
use the QueryExist code I posted....and the if statement.
Avatar of c9k9h

ASKER

Jeff . . . I've said it before and I'll say it again . . . I'm really glad you experts are out there!  

Thank you!
jt is definitely 'Out There', LOL !

mx
You know!! Always happy to help :o)
J