Help with turning off append/delete query messages.

  • Thread starter Thread starter welshdragon
  • Start date Start date
W

welshdragon

Guest
Can someone tell me how to automatically turn off the append/delete confirmation messages in Access when someone runs my database.

I have 2 append queries and 2 delete queries and I have manually turned off the confirmation through the menu "options-edit/find-confirm..." It is too confusing for new users when they come accross the messages.

Can it be done with a simple macro or with VB? Any suggestions would help. Thanks.
 
In your Sub, place "DoCmd.SetWarnings False" (without the quotes) as a line of the code before the query executes, then put "DoCmd.SetWarnings True" (without the quotes) as a line of code after the query has completed but before you exit your sub routine.

HTH
RDH

[This message has been edited by R. Hicks (edited 12-08-2000).]
 
I am running the queries through a form. I can't figure out where to put those statements.

I tried entering them in an event in the form via code builder. Any other suggestions?

Thanks
 
Post the code you are using to execute the queries from your form. We can then give you the exact code needed.

RDH
 
Ok, here is all the code from the form. Thank you for your replies, they really help!

---------------------------------------------
Option Compare Database

Private Sub Command30_Click()
On Error GoTo Err_Command30_Click

Dim stDocName As String

stDocName = "Append_Employee_History"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.GoToRecord , , acNewRec

Exit_Command30_Click:
Exit Sub

Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click


On Error GoTo Err_Command32_Click


DoCmd.GoToRecord , , acNewRec

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub

Private Sub Command30_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

End Sub
Private Sub Command31_Click()
On Error GoTo Err_Command31_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_Command31_Click:
Exit Sub

Err_Command31_Click:
MsgBox Err.Description
Resume Exit_Command31_Click

End Sub
Private Sub Command32_Click()
On Error GoTo Err_Command32_Click


DoCmd.GoToRecord , , acNewRec

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub
Private Sub Command34_Click()
On Error GoTo Err_Command34_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_Command34_Click:
Exit Sub

Err_Command34_Click:
MsgBox Err.Description
Resume Exit_Command34_Click

End Sub
Private Sub Append_Invoice_History_Click()
On Error GoTo Err_Append_Invoice_History_Click

Dim stDocName As String

stDocName = "Append_Invoice_History"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Append_Invoice_History_Click:
Exit Sub

Err_Append_Invoice_History_Click:
MsgBox Err.Description
Resume Exit_Append_Invoice_History_Click

End Sub
Private Sub Command37_Click()
On Error GoTo Err_Command37_Click


Screen.PreviousControl.SetFocus
DoCmd.FindNext

Exit_Command37_Click:
Exit Sub

Err_Command37_Click:
MsgBox Err.Description
Resume Exit_Command37_Click

End Sub
Private Sub Command38_Click()
On Error GoTo Err_Command38_Click

Dim stDocName As String

stDocName = "Macro1"
DoCmd.RunMacro stDocName

Exit_Command38_Click:
Exit Sub

Err_Command38_Click:
MsgBox Err.Description
Resume Exit_Command38_Click

End Sub

Private Sub Form_Open(Cancel As Integer)

End Sub
Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

Dim stDocName As String

stDocName = "Append_Employee_History"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub
Private Sub PrintDailySummary_Click()
On Error GoTo Err_PrintDailySummary_Click

Dim stDocName As String

stDocName = "Daily_Summary"
DoCmd.OpenReport stDocName, acNormal

Exit_PrintDailySummary_Click:
Exit Sub

Err_PrintDailySummary_Click:
MsgBox Err.Description
Resume Exit_PrintDailySummary_Click

End Sub
 
First and foremost, make a backup of your database.

I found several small problems in the code you posted. You had a couple of orphaned sub procedures that I removed. You also had problem in "Private Sub Command30_Click", you had a problem with your error handling statements. I fixed this also. I also added the needed code to deal with the message problem of your original post.

After you have backed the database up, open the original db and replaces the code you posted earlier with the code below. Maybe this will fix your problems.

'**************Begin Code******************
Private Sub Command30_Click()
On Error GoTo Err_Command30_Click

Dim stDocName As String

stDocName = "Append_Employee_History"
DoCmd.SetWarnings False
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings True
DoCmd.GoToRecord , , acNewRec

Exit_Command30_Click:
Exit Sub

Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click

End Sub

Private Sub Command31_Click()
On Error GoTo Err_Command31_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_Command31_Click:
Exit Sub

Err_Command31_Click:
MsgBox Err.Description
Resume Exit_Command31_Click

End Sub
Private Sub Command32_Click()
On Error GoTo Err_Command32_Click

DoCmd.GoToRecord , , acNewRec

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub
Private Sub Command34_Click()
On Error GoTo Err_Command34_Click

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_Command34_Click:
Exit Sub

Err_Command34_Click:
MsgBox Err.Description
Resume Exit_Command34_Click

End Sub
Private Sub Append_Invoice_History_Click()
On Error GoTo Err_Append_Invoice_History_Click

Dim stDocName As String

stDocName = "Append_Invoice_History"
DoCmd.SetWarnings False
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings True

Exit_Append_Invoice_History_Click:
Exit Sub

Err_Append_Invoice_History_Click:
MsgBox Err.Description
Resume Exit_Append_Invoice_History_Click

End Sub

Private Sub Command37_Click()
On Error GoTo Err_Command37_Click

Screen.PreviousControl.SetFocus
DoCmd.FindNext

Exit_Command37_Click:
Exit Sub

Err_Command37_Click:
MsgBox Err.Description
Resume Exit_Command37_Click

End Sub
Private Sub Command38_Click()
On Error GoTo Err_Command38_Click

Dim stDocName As String

stDocName = "Macro1"
DoCmd.RunMacro stDocName

Exit_Command38_Click:
Exit Sub

Err_Command38_Click:
MsgBox Err.Description
Resume Exit_Command38_Click

End Sub

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

Dim stDocName As String

stDocName = "Append_Employee_History"
DoCmd.SetWarnings False
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings True

Exit_Command39_Click:
Exit Sub

Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click

End Sub

Private Sub PrintDailySummary_Click()
On Error GoTo Err_PrintDailySummary_Click

Dim stDocName As String

stDocName = "Daily_Summary"
DoCmd.OpenReport stDocName, acNormal

Exit_PrintDailySummary_Click:
Exit Sub

Err_PrintDailySummary_Click:
MsgBox Err.Description
Resume Exit_PrintDailySummary_Click

End Sub
'**************End Code******************

HTH
RDH
 

Users who are viewing this thread

Back
Top Bottom