标题:求大神帮我看看这个,提示我缺少函数或者变量
只看楼主
nathan111
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2014-6-22
结帖率:0
已结贴  问题点数:20 回复次数:2 
求大神帮我看看这个,提示我缺少函数或者变量
附件 是图 代码如下
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

我做的是用一个添加按钮,将文本框里面的数据输入到数据库中,但是老是提示我出错
搜索更多相关主题的帖子: 信息 
2014-06-22 23:24
tlliqi
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:204
帖 子:15453
专家分:65956
注 册:2006-4-27
得分:10 
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 = ""
要加上if ... endif或是别的什么吧
2014-06-23 08:42
Artless
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:103
帖 子:4211
专家分:28888
注 册:2009-4-8
得分:10 
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
  End Sub
 Private Sub Command2_Click()
 Unload Me
 Form2.Show
 End Sub

无知
2014-06-23 10:31



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-433252-1-1.html




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

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