AlvaroCity
Registered User.
- Local time
- Today, 08:34
- Joined
- Jul 16, 2016
- Messages
- 70
Hi there.
I'd like to use this to delete a record from a form.
I cannot use the easy way such as "DoCmd.RunCommand acCmdDeleteRecord" so there are so many different fields from other tables that this command actually works.
So I am forced to use a sql delete to do it.
Could you tell me please if there is something wrong in here??
It pop ups an error during the DoCmd.RunSQL sql step
I'd like to use this to delete a record from a form.
I cannot use the easy way such as "DoCmd.RunCommand acCmdDeleteRecord" so there are so many different fields from other tables that this command actually works.
So I am forced to use a sql delete to do it.
Code:
Dim sql As String
Dim str As String
str = Me.frmPedidoDetalleMat.Form!PedidoMatDetalleID
If MsgBox("¿Estas seguro que quieres eliminar el Registro de Material?", vbExclamation + vbYesNo, "Eliminar Registro de Material") = vbYes Then
sql = "DELETE * FROM [tblPedidoDetalleMat] WHERE [PedidoMatDetalleID] =" & str & ""
DoCmd.SetWarnings (0)
DoCmd.RunSQL sql
DoCmd.SetWarnings (1)
Me.Refresh
Forms!frmPedidoMat.Form.Refresh
Forms!frmHome.Form.Refresh
End If
Could you tell me please if there is something wrong in here??
It pop ups an error during the DoCmd.RunSQL sql step