Hi guys
I have a question
Can I cancel this message or replaced.
With a deletion, or a message appears (Yes/cancel) only.
I hope to help.
Greetings Azar
Hi guys
I have a question
Can I cancel this message or replaced.
With a deletion, or a message appears (Yes/cancel) only.
I hope to help.
Greetings Azar
if you are running a query by opening it manually - then no
if you are running from vba use currentdb.execute rather than docmd.runsql
Thank you Ajax
I use this code in order to delete an invoice
Code:Private Sub Command47_Click() On Error GoTo Command47_Click_Err On Error Resume Next DoCmd.GoToControl Screen.PreviousControl.Name Err.Clear If (Not Form.NewRecord) Then DoCmd.RunCommand acCmdDeleteRecord End If If (Form.NewRecord And Not Form.Dirty) Then Beep End If If (Form.NewRecord And Form.Dirty) Then DoCmd.RunCommand acCmdUndo End If If (MacroError <> 0) Then Beep MsgBox MacroError.Description, vbOKOnly, "" End If Command47_Click_Exit: Exit Sub Command47_Click_Err: MsgBox Error$ Resume Command47_Click_Exit End Sub
so use
currentdb.execute "DELETE * FROM myTable WHERE tblID=" & me.tblID
change the bits in red to the appropriate names
I've used it the way
currentdb.execute rather than docmd.runsql
Shows me this error
What is the solution Thanks in advance
<p>Thank you so much Ajax <br> It was a mistake in the name of the table, instead of a query must be Workorders <br></p>Code:<br>Private Sub Command49_Click()<br>If MsgBox(Prompt:="My question", Buttons:=vbYesNo) = vbYes Then<br> CurrentDb.Execute "DELETE FROM Workorders WHERE WorkorderID=" & Me.WorkorderID<br> Else<br> MsgBox "Delete canceled"<br> End If</p><p>End Sub<br><br>
Thank you so much Ajax
It was a mistake in the name of the table, instead of a query must be Workorders
Private Sub Command49_Click()
If MsgBox(Prompt:="My question", Buttons:=vbYesNo) = vbYes Then
CurrentDb.Execute "DELETE FROM Workorders WHERE WorkorderID=" & Me.WorkorderID
Else
MsgBox "Delete canceled"
End If
End Sub
no problem