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!
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!
Public Sub TurnWarningsOn()
DoCmd.SetWarnings True
End Sub
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)
and then click the run button. That will turn them back on for you.Code:Public Sub TurnWarningsOn() DoCmd.SetWarnings True End Sub
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_LSPDataNewProgramNewAgencyNewClientID"
DoCmd.SetWarnings True
ProcessImportedData
Else
MsgBox "Import canceled." & vbCrLf & "Please select correct file.", vbInformation, "System Notice"
End If
DoCmd.SetWarnings True
End Sub
Hi Evan, This is an old issue but I am experiencing the exact same issue now running Access 365. I cannot get the confirm delete message to show unless I do what you do above. Very flakey. I have warnings completely turned on as well. I wonder if anyone every found a way around this Access bug.Problem UN-solved
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
You need to make sure every place you turned them off that you turn them back on or it will continue to happen.Hi Evan, This is an old issue but I am experiencing the exact same issue now running Access 365. I cannot get the confirm delete message to show unless I do what you do above. Very flakey. I have warnings completely turned on as well. I wonder if anyone every found a way around this Access bug.
That is a great reminder and something I often forget. I usually just use .execute and never end up with any reason to adjust warnings in the first place, but a good reminder if they are off, esp. for those of us in the habit of saving things (in general) but x'ing out of them and hitting the space bar!NOTE: leaving warnings off accidentally can cause you to loose object changes you make during development. If warnings are off and you change an object and just close it without specifically saving it, Access will just discard the changes without warning. Very painful![]()