Running Query In VBA, Bypassing Warnings?

P

(PeteCresswell)

I've got a couple of "Delete" queries that operate on tables
where there are recursive relationships between records.

Net result is that the first time I run the query, it will throw
something like "Cannot delete all records...." and then it will
delete something like 79,000 records - leaving 17,000 or so tb
deleted on the next pass.

I can run the query manually five times and gradually whittle
down the records to where everything is deleted that I want to
delete.

But how to do that in VBA?

DoCmd.SetWarnings does not seem to cover that situation.

Also, on the first iteration the query throws "There isn't enough
disk space or memory to undo....." which SetWarnings also does
not seem to address.

There's got tb another parm/function that tells VBA to go ahead,
but what?
 
D

David W. Fenton

Currentdb.execute should work.

Tony, that was a forged post -- it was not from Pete Cresswell at
all, but from a spammer pushing his SQL Injection testing tools (as
though they would work with Access!).
 
T

Tony Toews

Tony, that was a forged post -- it was not from Pete Cresswell at
all, but from a spammer pushing his SQL Injection testing tools (as
though they would work with Access!).

??? There was no mention on that posting of SQL Injection tools. I
looked at a recent posting of Pete's and it too was using Agent 6.0
whereas the spammer was not. So I'm pretty sure it's a genuine post.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 
D

David W. Fenton

Per Tony Toews:

It was.

Well, I don't have a clue what happened there. I must have been
looking at a different post than Pete's. Not sure what happened at
all.
 
P

(PeteCresswell)

Per David W. Fenton:
Well, I don't have a clue what happened there. I must have been
looking at a different post than Pete's. Not sure what happened at
all.

This may be perverse, but I find a certain sense of relief when
somebody else does something like that..... i.e. I'm not the only
one.... -)
 
D

David W. Fenton

Per David W. Fenton:

This may be perverse, but I find a certain sense of relief when
somebody else does something like that..... i.e. I'm not the only
one.... -)

I suspect it was a case where the connection to my news server
failed, and it was waiting to load the next article while still
displaying the previous one, but I somehow thought it was the new
article.

Only a guess, though.
 
T

Tony Toews

This may be perverse, but I find a certain sense of relief when
somebody else does something like that..... i.e. I'm not the only
one.... -)

Hehehehe. Agreed. Especially when it's a long time competent
regular such as David. <smile>

I just had an infinite loop yesterday. I copied the code for a
recordset loop inside another recordset loop. Changed most, but not
all of the recordset variables to the new recordset name. The one I
missed was the movefirst. So within the inner loop I was resetting
the outside loop recordset to the first record.

Sure filled up the debug window fast. Hehehe

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top