| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 520 人关注过本帖
标题:类型不匹配问题?
只看楼主 加入收藏
dlb2000
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-3-16
收藏
 问题点数:0 回复次数:1 
类型不匹配问题?

Option Explicit

Private Sub Command1_Click()

If Text1.Text = "" Then
MsgBox "j影片编号不能为空!", vbInformation + vbOKOnly, "警告"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "影片名称不能为空!", vbInformation + vbOKOnly, "警告"
Text2.SetFocus
Exit Sub
End If
If Combo1.Text = "" Then
MsgBox "影片类别不能为空!", vbInformation + vbOKOnly, "警告"
Combo1.SetFocus
Exit Sub
End If
If Text4.Text = "" Then
MsgBox "影片数量不能为空!", vbInformation + vbOKOnly, "警告"
Text4.SetFocus
Exit Sub
End If
If Text5.Text = "" Then
MsgBox "影片价格不能为空!", vbInformation + vbOKOnly, "警告"
Text5.SetFocus
Exit Sub
End If


Set g_rs = g_db.OpenRecordset("select * from qbyd", dbOpenDynaset)
If g_rs.RecordCount > 0 Then
g_rs.MoveFirst
Do While Not g_rs.EOF
If g_rs!影片编号 = Text1.Text Then
MsgBox "对不起,该影片编号已经存在,请重新输入!", vbInformation + vbOKOnly, "警告"
Set g_rs = Nothing
Exit Sub
End If
g_rs.MoveNext
Loop
End If
g_rs.AddNew
g_rs!影片编号 = Text1.Text
g_rs!影片名称 = Text2.Text
g_rs!影片类别 = Mid(Combo1.Text, 1, 1)

g_rs!影片姓名 = Text4.Text
g_rs!影片价格 = Text5.Text

g_rs!入库日期 = DTPicker1.Value
g_rs!是否借出 = False
g_rs.Update

Text1.Text = ""
Text2.Text = ""

Text4.Text = ""
Text5.Text = ""

Set g_rs = Nothing
MsgBox "影片信息已成功添加!", vbInformation + vbOKOnly, "信息"

End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()

dbl
DTPicker1.Value = Date
Set g_rs = g_db.OpenRecordset("yplb", dbOpenTable)
Combo1.Clear
If g_rs.RecordCount > 0 Then
g_rs.MoveFirst
Do While Not g_rs.EOF
Combo1.AddItem g_rs!类别编号 + "-" + g_rs!影片类别
g_rs.MoveNext
Loop
Set g_rs = Nothing
Else
MsgBox "请先设置影片类别编号!", vbInformation + vbOKOnly, "警告"
影碟类别设置.Show
Unload Me
End If

End Sub

系统提示:
Set g_rs = g_db.OpenRecordset("yplb", dbOpenTable)
类型不匹配

搜索更多相关主题的帖子: 类型 
2006-03-23 11:16
俺老虎
Rank: 1
等 级:新手上路
帖 子:78
专家分:0
注 册:2005-9-15
收藏
得分:0 
set g_db=opendatabase("dbpath")
set rs=g_db.openrecordset("tablename", 参数)
引用microsoft DAO 3.6 objectlibrary

http://www. 爱博客 只要一分钟,建立你自己的博客网站 完全免费哦~
2006-03-23 14:03
快速回复:类型不匹配问题?
数据加载中...
 
   



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

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