添加代码:
Private Sub Command9_Click()
If Command9.Caption = "添加" Then
Command9.Caption = "确定"
Command10.Caption = "取消"
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text7.SetFocus
Data1.Refresh
Data1.Recordset.AddNew
Else
Command9.Caption = "添加"
Command10.Caption = "编辑"
Data1.Recordset.Update
Data1.Refresh
End If
End Sub
编辑代码:
Private Sub Command10_Click()
If Command10.Caption = "编辑" Then
Command10.Caption = "取消"
Command9.Caption = "确定"
Else
Command10.Caption = "编辑"
Command9.Caption = "添加"
Data1.Recordset.CancelUpdate
Data1.Refresh
End If
End Sub
点编辑后,修改数据完成后点确定就出现错误:在不使用addnew 或edit的情况下,更新update或取消更新cancle update.
Private Sub Command9_Click()
If Command9.Caption = "添加" Then
Command9.Caption = "确定"
Command10.Caption = "取消"
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text7.SetFocus
Data1.Refresh
Data1.Recordset.AddNew
Else
Command9.Caption = "添加"
Command10.Caption = "编辑"
Data1.Recordset.Update
Data1.Refresh
End If
End Sub
编辑代码:
Private Sub Command10_Click()
If Command10.Caption = "编辑" Then
Command10.Caption = "取消"
Command9.Caption = "确定"
Else
Command10.Caption = "编辑"
Command9.Caption = "添加"
Data1.Recordset.CancelUpdate
Data1.Refresh
End If
End Sub
点编辑后,修改数据完成后点确定就出现错误:在不使用addnew 或edit的情况下,更新update或取消更新cancle update.
在不是很有把握的情况下,不要把按纽的CAPTION和功能换来换去,老老实实多放几个按纽,一个一个写代码,单步调试吧