Running Query at Form CLose

halem2

Registered User.
Local time
Today, 16:09
Joined
Nov 8, 2006
Messages
180
Hi folks:

Running Access 2000. I have a form and a delete query. I added the following code to run on the form's On Close event and it works fine but it prompts the user to confirm the delete.

Is there a way to hide or prevent the prompt to show up using code?


DoCmd.OpenQuery "qryDeleteEmptyCourses", acViewNormal

thanks
 
Have you tried

Code:
DoCmd.SetWarnings False

DoCmd.OpenQuery "qryDeleteEmptyCourses", acViewNormal

DoCmd.SetWarnings True

I think that should work.
 
Code:
DoCmd.SetWarnings(False)
DoCmd.OpenQuery "qryDeleteEmptyCourses", acViewNormal
DoCmd.SetWarnings(True)

and I would put an error handler in and put the SetWarnings(True) part in there too, because if an error occurs in the process of running the query you could well find yourself without any warnings whatsoever.
 
you guys are good.

I was trying

DoCmd.SetWarnings = False
DoCmd.OpenQuery "qryDeleteEmptyCourses", acViewNormal
DoCmd.SetWarnings = True

but the "=" was making it fail.

Thanks both:D
 
Nah, he's good. I just hang around and catch some of the adulation, as it washes off. :D

Well thanks Matt. I think you are pretty great too. And, it's funny how it happens when making a response we can get about 2-3 responses all within a few seconds of each other.
 
Great!

I was just about to post a similar question...

Thanks folks!
 

Users who are viewing this thread

Back
Top Bottom