我要修改一段记录 当按下'修改'按钮时出错了 显示是" 实时错误'424': 要求对象 " 下面是我的代码 请各们朋友帮忙 先谢谢了
Private Sub Command4_Click()
If Trim(Me.MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)) = "" Then
MsgBox "你还没有选择记录!", vbOKOnly + vbExclamation, "警告"
Else
If Command4.Caption = "确定" Then
If Text1.Text = "" Then
MsgBox "课件编号不能为空!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "课件名称不能为空!", vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "创建日期不能为空!", vbOKOnly + vbExclamation, "警告"
Text3.SetFocus
Exit Sub
End If
If Text4.Text = "" Then
MsgBox "主讲教师不能为空!", vbOKOnly + vbExclamation, "警告"
Text5.SetFocus
Exit Sub
End If
If Not IsNumeric(Text5.Text) Then
MsgBox "课时必须为数字!", vbOKOnly + vbExclamation, "警告"
Text5.SetFocus
Exit Sub
End If
Adodc1.RecordSource = "select * from 课件表 where 课件编号='" & Trim(Me.MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)) & "'"
Adodc1.Refresh
Adodc1.Recordset.Fields(0) = Text1.Text
Adodc1.Recordset.Fields(1) = Text2.Text
Adodc1.Recordset.Fields(2) = Text3.Text
Adodc1.Recordset.Fields(3) = Text4.Text
Adodc1.Recordset.Fields(4) = Text5.Text
Adodc1.Recordset.Fields(5) = Text6.Text
Adodc1.Recordset.Update
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
InitTitle
InitData
Command4.Caption = "修改"
m03.Caption = "修改所选课件"
Command2.Enabled = True
Command3.Enabled = True
m01.Enabled = True
m02.Enabled = True
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Else
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text1.SetFocus
Command4.Caption = "确定"
m03.Caption = "确定修改"(我按调试 指针指示到这一条)
m01.Enabled = False
m02.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
End If
End If
End Sub
下面是m03 m01 m02的定义
Private Sub m01_Click()
'add
Command2_Click
End Sub
Private Sub m02_Click()
'delete
Command3_Click
End Sub
Private Sub m03_Click()
'modify
Command4_Click
End Sub