Private Sub cmdBaru_Click( )
Adodc1.Recordset.AddNes
End Sub
Private Sub cmdHapus_Click( )
On Error GoTo HapusSalah:
Adodc1.Recordset.Delete
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveFirst
End If
SelesaiHapus:
Exit Sub
HapusSalah:
MsgBox Err.Number & vbCrLf & Err.Description
Resume SelesaiHapus
End Sub
Private Sub cmdKelua_Click( )
If Adodc1.Recordset.EditMode = adEditAdd Then
If MsgBox ("Anda yakin ingin menyimpan data ini?", vbYesNO, "Question") = vbYes Then
Simpan
End If
End If
Unload Me
End Sub
Private Sub Simpan( )
If Adodc1.Recordset.EditMode = adEditAdd Then
On Error GoTo SimpanSalah:
Adodc1.Recordset.Update
On Error GoTo 0
End If
SelesaiSimpan:
Exit Sub
SimpanSalah:
MsgBox Err.Number & vbCrLf & Err.Desciption
Resume SelesaiSimpan
End Sub
Private Sub cmdSimpan_Click( )
Simpan
End Sub
No comments:
Post a Comment