注册 登录
编程论坛 VB6论坛

求大神帮我看看这个,提示缺少函数或者变量

nathan111 发布于 2014-06-22 23:25, 986 次点击
Private Sub Command1_Click()

If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Text10.Text = "" Or Text11.Text = "" Or Text12.Text = "" Or Text13.Text = "" Or Text14.Text = "" Or Text15.Text = "" Or Text16.Text = "" Then
MsgBox "填写的信息不完整", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Exit Sub
End If
With Datal
.Recordset.AddNew
.Recordset.Fields("款号") = Text1.Text
.Recordset.Fields("品号") = Text2.Text
.Recordset.Fields("颜色") = Text3.Text
.Recordset.Fields("色号") = Text4.Text
.Recordset.Fields("S") = Text5.Text
.Recordset.Fields("M") = Text6.Text
.Recordset.Fields("L") = Text7.Text
.Recordset.Fields("XL") = Text8.Text
.Recordset.Fields("XXL") = Text9.Text
.Recordset.Fields("XXL") = Text11.Text
.Recordset.Fields("库存数") = Text12.Text
.Recordset.Fields("价格") = Text13.Text
.Recordset.Fields("分类") = Text14.Text
.Recordset.Fields("面料") = Text15.Text
.Recordset.Fields("季节") = Text16.Text
.Recordset.Fields("年份") = Text10.Text
End With
Datal Refresh
Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Text10.Text = "" Or Text11.Text = "" Or Text12.Text = "" Or Text13.Text = "" Or Text14.Text = "" Or Text15.Text = "" Or Text16.Text = ""
Text1.SetFocus

End Sub
Private Sub Command2_Click()
Unload Me
Form2.Show
End Sub
5 回复
#2
风吹过b2014-06-23 09:34
只看到 16个文本框和一个数据库控件。
最后还有一个 Form2 的窗体。
所有的代码里,没看到有变量或函数的存在。

如果执行提示变量未定义或函数未定义,那就要看你的控件是否放全了,是否连接了数据库。
#3
w3609894262014-06-23 21:02
你是不是在做一个录入数据的程序?
#4
alike1232014-06-24 12:54
问题应该在data1,你这个data1是自己加的控件还是定义的变量(没看到你定义)
#5
yangfrancis2014-06-24 14:37
data1估计应该是楼主做界面时添加的控件吧,因此没涉及到代码。我觉得关键是data1.refresh之后清空文本框的语句不能用罗辑运算符连接,把这里所有的or改成:再试试看是否报错。
#6
alike1232014-06-24 14:59
楼上一说我才注意到,无力吐槽
1