I currently have a button (All_Current_On) on a form that refers to the query (Update_All_Items_Turned_On). This query is a simple update query that changes a Yes/No field for all records in the table from "NO" to "YES."
UPDATE Current_Items_Info SET Current_Items_Info.[Item_ON-Off] = Yes;
The buttons code is shown below:
Private Sub All_Current_On_Click()
Dim choice as Integer
Dim stDocName As String
choice = MsgBox ("Do you want to turn all items ON?,"vbYesNo)
If choice = 6 then
On Error GoTo Err_All_Current_On_Click
stDocName = "Update_All_Items_Turned_On"
DoCmd.OpenQuery stDocName, acNormal, acEdit
MsgBox ("All items were turned ON.")
Exit_All_Current_On_Click:
Exit Sub
Err_All_Current_On_Click:
MsgBox Err.Description
Resume Exit_All_Current_On_Click
ElseIf choice = 7 then
MsgBox("No changes were made.")
Else
MsgBox("No changes were made.")
End If
End Sub
When the query is run, 2 boxes pop up default from creating an update query.
The first asks "You are about to run an update query that will modify data in your table. Yes/No/Help."
The second asks "You are about to update ## row(s). Yes/No."
Rather than having the user have to hit "Yes" twice from the default Access prompts, I've created a Yes/No msgbox prompt in the button code that will prompt the user once to confirm/cancel the change. I'd like to remove (auto-accept) the 2 prompts that appear after creating any update query. Any ideas if this can be done?
UPDATE Current_Items_Info SET Current_Items_Info.[Item_ON-Off] = Yes;
The buttons code is shown below:
Private Sub All_Current_On_Click()
Dim choice as Integer
Dim stDocName As String
choice = MsgBox ("Do you want to turn all items ON?,"vbYesNo)
If choice = 6 then
On Error GoTo Err_All_Current_On_Click
stDocName = "Update_All_Items_Turned_On"
DoCmd.OpenQuery stDocName, acNormal, acEdit
MsgBox ("All items were turned ON.")
Exit_All_Current_On_Click:
Exit Sub
Err_All_Current_On_Click:
MsgBox Err.Description
Resume Exit_All_Current_On_Click
ElseIf choice = 7 then
MsgBox("No changes were made.")
Else
MsgBox("No changes were made.")
End If
End Sub
When the query is run, 2 boxes pop up default from creating an update query.
The first asks "You are about to run an update query that will modify data in your table. Yes/No/Help."
The second asks "You are about to update ## row(s). Yes/No."
Rather than having the user have to hit "Yes" twice from the default Access prompts, I've created a Yes/No msgbox prompt in the button code that will prompt the user once to confirm/cancel the change. I'd like to remove (auto-accept) the 2 prompts that appear after creating any update query. Any ideas if this can be done?