ADODC in VB 6.0 to MS Access with DataGrid Control
CODE
Private Sub cmdDelete_Click()
On Error Resume Next
If MsgBox("Data is not recoverable!", vbInformation + vbOKCancel, "Confirm Delete") = vbOK Then
Adodc1.Recordset.Delete
Else
txtName.SetFocus
End If
End Sub
Private Sub cmdFirst_Click()
Adodc1.Recordset.MoveFirst
End Sub
Private Sub cmdLast_Click()
Adodc1.Recordset.MoveLast
End Sub
Private Sub cmdNext_Click()
If Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.MoveFirst
Else
Adodc1.Recordset.MoveNext
End If
End Sub
Private Sub cmdPrevious_Click()
If Adodc1.Recordset.BOF = True Then
Adodc1.Recordset.MoveLast
Else
Adodc1.Recordset.MovePrevious
End If
End Sub
Private Sub cmdSave_Click()
If txtName.Text = "" Or txtAge.Text = "" Or txtCourse.Text = "" Then
MsgBox "Empty Fields!", vbExclamation, "Input Error"
Else
Adodc1.Recordset.AddNew
Adodc1.Recordset("Name") = txtName.Text
Adodc1.Recordset("Age") = txtAge.Text
Adodc1.Recordset("Course") = txtCourse.Text
Call clear
End If
End Sub
Sub clear()
txtName.Text = ""
txtAge.Text = ""
txtCourse.Text = ""
txtName.SetFocus
End Sub
Labels:
vb
,
visual basic 6.0
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment