程序编译出错,代码如下:
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0
If Command1(0).Caption = "添加" Then
Command1(0).Caption = "确定"
Command1(1).Caption = "取消"
Data1.Recordset.AddNew '出错处:实时错误'91'
'对象变量或With块变量未设置
Tenable (False)
Else
Command1(0).Caption = "添加"
Command1(1).Caption = "编辑"
Data1.Recordset.Update 大家帮忙啊,好吗,先谢谢了!
Tenable (True)
End If
Case 1
If Command1(1).Caption = "添加" Then
Command1(0).Caption = "确定"
Command1(1).Caption = "取消"
Data1.Recordset.Edit
Tenable (False)
Else
Command1(0).Caption = "添加"
Command1(1).Caption = "编辑"
Data1.Recordset.CancelUpdate
Data1.Refresh
Tenable (True)
End If
Case 2
Data1.Recordset.Delete
Data1.Recordset.MoveNext
End Select
Text1(0).SetFocus
End Sub
Private Sub Tenable(ByVal setvalue As Boolean)
Dim x As TextBox
For Each x In Text1
x.Locked = setvalue
Next
Command1(2).Visible = setvalue
Data1.Enabled = setvalue
End Sub
Private Sub Data1_Reposition()
Data1.Caption = " 记录号:" & (Data1.Recordset.AbsolutePosition + 1) & "/" & Data1.Recordset.RecordCount
End Sub
Private Sub TExt1_KeyPress(Inddex As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
i = (Index + 1) Mod 5
Text1(i).SetFocus
End If
End Sub
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0
If Command1(0).Caption = "添加" Then
Command1(0).Caption = "确定"
Command1(1).Caption = "取消"
Data1.Recordset.AddNew '出错处:实时错误'91'
'对象变量或With块变量未设置
Tenable (False)
Else
Command1(0).Caption = "添加"
Command1(1).Caption = "编辑"
Data1.Recordset.Update 大家帮忙啊,好吗,先谢谢了!
Tenable (True)
End If
Case 1
If Command1(1).Caption = "添加" Then
Command1(0).Caption = "确定"
Command1(1).Caption = "取消"
Data1.Recordset.Edit
Tenable (False)
Else
Command1(0).Caption = "添加"
Command1(1).Caption = "编辑"
Data1.Recordset.CancelUpdate
Data1.Refresh
Tenable (True)
End If
Case 2
Data1.Recordset.Delete
Data1.Recordset.MoveNext
End Select
Text1(0).SetFocus
End Sub
Private Sub Tenable(ByVal setvalue As Boolean)
Dim x As TextBox
For Each x In Text1
x.Locked = setvalue
Next
Command1(2).Visible = setvalue
Data1.Enabled = setvalue
End Sub
Private Sub Data1_Reposition()
Data1.Caption = " 记录号:" & (Data1.Recordset.AbsolutePosition + 1) & "/" & Data1.Recordset.RecordCount
End Sub
Private Sub TExt1_KeyPress(Inddex As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
i = (Index + 1) Mod 5
Text1(i).SetFocus
End If
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货