View Full Version : no warning messge when runing the delete, append or update query!
why isn't my Access giving me warning before runing the delete, append or update query because usually it warns you that you are about to append, update or delete the following number of records. It must be the settings, can someone help!
rainman89 04-11-2007, 10:52 AM why isn't my Access giving me warning before runing the delete, append or update query because usually it warns you that you are about to append, update or delete the following number of records. It must be the settings, can someone help!
Tools>options> edit/find tab
Make sure confirm
action queries is checked
boblarson 04-11-2007, 10:58 AM And, if you've EVER used
DoCmd.SetWarnings False
Then you could have messed things up because if you do that and it errors out before getting to DoCmd.SetWarnings True, then you will not get anymore warnings, ever - until you turn them back on.
So, what I usually do is to put, as the first line, in my error handler -
DoCmd.SetWarnings True
And if you want to see if that was the problem, copy this into a Standard Module (not a form module)
Public Sub TurnWarningsOn()
DoCmd.SetWarnings True
End Sub
and then click the run button. That will turn them back on for you.
aftershokk 08-31-2007, 09:22 AM I tried both both replies it is not working for me? any other ideas
aftershokk 09-28-2007, 05:13 AM I forget to post that it did work.
Dudley 10-31-2007, 09:34 AM And, if you've EVER used
DoCmd.SetWarnings False
Then you could have messed things up because if you do that and it errors out before getting to DoCmd.SetWarnings True, then you will not get anymore warnings, ever - until you turn them back on.
So, what I usually do is to put, as the first line, in my error handler -
DoCmd.SetWarnings True
And if you want to see if that was the problem, copy this into a Standard Module (not a form module)
Public Sub TurnWarningsOn()
DoCmd.SetWarnings True
End Sub
and then click the run button. That will turn them back on for you.
Hi, does DoCmd.SetWarnings True override the system setting Confirm Action Queries 'checked'? It doesn't seem to on my machine - Confirm Action Queries is "on" right now, and I have code to set warnings false before running some append and update queries, and I'm being asked if it is okay to perform the queries. I must be missing something. Here's some code:
Private Sub cmdImport1_5_Click()
Dim db As Database
Set db = CurrentDb()
If MsgBox("Is this the correct file?", vbQuestion + vbYesNo, "File verification") = vbYes Then
DoCmd.SetWarnings False
' CleanUpTables 'Delete previously-imported tables - tables whose names end in "1"
'Import the new objects. strPath is the file you selected from the browsing window. This is the file you import from.
DoCmd.TransferDatabase acImport, "Microsoft Access", Me.Text1, acTable, "tblClients", "tblData_Clients1", False
DoCmd.TransferDatabase acImport, "Microsoft Access", Me.Text1, acTable, "tblClientMedicalConditions", "tblData_ClientMedicalConditions1", False
DoCmd.TransferDatabase acImport, "Microsoft Access", Me.Text1, acTable, "tblLSPData", "tblData_LSP_Scores1", False
DoCmd.TransferDatabase acImport, "Microsoft Access", Me.Text1, acTable, "tblLU-Agency", "tblLU_Agency1", False
DoCmd.TransferDatabase acImport, "Microsoft Access", Me.Text1, acTable, "tblLU-Ethnicity", "tblLU_Ethnicity1", False
DoCmd.TransferDatabase acImport, "Microsoft Access", Me.Text1, acTable, "tblLU-MedicalCondition", "tblLU_MedicalCondition1", False
DoCmd.TransferDatabase acImport, "Microsoft Access", Me.Text1, acTable, "tblLU-Program", "tblLU_Program1", False
' If MsgBox("Do you really want to proceed with the import?", vbQuestion + vbYesNo, "Proceed?") = vbYes Then
'Run action queries to perform the data transfer
DoCmd.SetWarnings False
db.Execute "qryMIGRATEv5_1a_Agency"
db.Execute "qryMIGRATEv5_1b_Ethnicity"
db.Execute "qryMIGRATEv5_1c_Program"
db.Execute "qryMIGRATEv5_1d_MedicalCondition"
db.Execute "qryMIGRATEv5_2a_ClientsData"
db.Execute "qryMIGRATEv5_2b_ClientMedicalConditions"
db.Execute "qryMIGRATEv5_3_LSPDataNewProgramNewAgencyNewClient ID"
DoCmd.SetWarnings True
ProcessImportedData
Else
MsgBox "Import canceled." & vbCrLf & "Please select correct file.", vbInformation, "System Notice"
End If
DoCmd.SetWarnings True
End Sub
Thanks for your help!
Thanks!
evanscamman 12-13-2007, 07:36 PM I'm having the same problem. I did everything suggested in this thread, but still no confirmation when deleting a record.
Any other ideas?
Thank you,
Evan
evanscamman 12-13-2007, 07:51 PM I think it is fixed now - but I don't know why.
After reading someone else's post, i tried messing around with the
Delete, BeforeDeleteConfirm, AfterDeleteConfirm events.
They didn't already exist so I created them. Even though they were blank events, suddenly my warnings messages started reappearing!
Looks like it just needed some kind of "reboot" of the delete process.
Evan
aftershokk 12-14-2007, 04:25 AM I just make sure I set warnings "on" now consistently after I turn them off in my macros. My issue is resolved.
evanscamman 12-14-2007, 08:14 PM I spoke too soon. The problem comes and goes, and it seems to be SOOO weird, I wonder if anybody can figure this out...?
Access is supposed to run the delete events in this order:
BeforeDeleteConfirm
AfterDeleteConfirm
Delete
But it is skipping the 1st 2 events and going directly to Delete
Here's the weird part:
If I add a break-point somewhere in the delete event (but don't change any code), the next time I delete a record there is no confirmation - but the second time I delete, suddenly the Before and After delet confirm events are triggered!!! My delete confirmation is back.
And it stays back as long as I still have a break point in the Delete event.
As soon as i remove the break point, (actually the time after that), Access starts skipping the Before and After events again!
This is too weird for me - does anyone have any idea of what is happening here? Nothing in the code is changing - i'm just toggling a breakpoint!
Thank you,
Evan
|
|