| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3946 人关注过本帖
标题:实时错误'424': 要求对象
只看楼主 加入收藏
sun034
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-5-10
收藏
 问题点数:0 回复次数:3 
实时错误'424': 要求对象

我要修改一段记录 当按下'修改'按钮时出错了 显示是" 实时错误'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

搜索更多相关主题的帖子: 实时错误 要求对象 Then Sub 
2006-05-10 14:17
VB爱上我
Rank: 6Rank: 6
等 级:贵宾
威 望:25
帖 子:478
专家分:52
注 册:2005-10-14
收藏
得分:0 
有没有m01这个名称的控件,或有没有实例化这个.Set m01 = command1

IT618资讯网 提供服务端开发,前端开发,网页特效,热门开源系统研究,软件下载,站长建站,淘宝开店等学习资料.
2006-05-10 15:58
xk123
Rank: 1
等 级:新手上路
帖 子:32
专家分:9
注 册:2006-2-7
收藏
得分:0 

汗.........怎么怎么多代码
上面的可以简化
------------------------------------------
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
----------------------------------------------
If Not IsNumeric(Text1 or text2 or text3 or text4 or text5) Then
MsgBox "课时必须为数字!", vbOKOnly + vbExclamation, "警告"
Text5.SetFocus
Exit Sub
End If
----------------------------------
..

2006-05-10 16:22
sun034
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-5-10
收藏
得分:0 
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

上面这些不是对m01几个进行定义了吗 要是不算话那就没有了 没有实例化要怎样去做呢?

2006-05-10 17:52
快速回复:实时错误'424': 要求对象
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017665 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved