View Full Version : update query problem


travismp
05-04-2007, 06:27 AM
I have 3 or 4 update/delete queries. Right now if a user clicks one of the queries it will first prompt

"you are about to update X amount of rows...are you sure you want to do this action?"

if the user hits "YES" it works fine.
if the user hits "NO" it still finishes the act as if yes was hit.

It never cancels the act.

What is going on?

rainman89
05-04-2007, 06:28 AM
whats the code for the msgbox prompt?

sounds like u need a
cancel=true
on the No button click

boblarson
05-04-2007, 06:31 AM
Are you sure it's deleting the rows or does it just go on to the next set?

A better way to do it might be this:


If MsgBox("Are you sure you want to delete these rows?","vbQuestion + vbYesNo,"Delete Confirmation") = vbYes Then
CurrentDb.Execute "qryNameHere"
Else
MsgBox "Delete was canceled", vbInformation, "Action Canceled"
End If


and that can be in place of where you currently call your queries.

travismp
05-04-2007, 06:38 AM
it does it for update queries too.

My account dept each week has to updatew a couple thousand records from not billed to billed with a checkbox. Right now when she clicks the update query it will give her the defualt windows prompt.

if she hits yes it works fine.
if she hits no it still carries out the update.

why would it do this if she hits no?

It is almost like there is some macro or vb script that is open all the time saying "ignore all NO commands"

boblarson
05-04-2007, 06:41 AM
I'm not sure why. But, as Rural Guy has pointed out before, you can avoid the error messages by using CurrentDb.Execute for executing action queries, but you can nest the running of them in your own confirmations so that it will bypass running them if they don't want to.

Maybe someone else has an idea as to why your "No" doesn't seem to cancel it. I'm not really sure.

travismp
05-04-2007, 06:53 AM
first off thank you for the ideas so far. I do not fully understand your suggestions, but I will sit down Sat morning and see if I can change my system the way you guys are saying. If I have problems I will be back.

Thank you very much so far...