为了账号安全,请及时绑定邮箱和手机立即绑定

这个是我的代码,但是在运行的时候说缺少函数或者变量,我是想要添加一个东西到数据库的表里面?

这个是我的代码,但是在运行的时候说缺少函数或者变量,我是想要添加一个东西到数据库的表里面?

烙印99 2022-08-11 11:07:51
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 = "" ThenMsgBox "填写的信息不完整", vbOKOnly + vbExclamation, ""Text1.SetFocusExit SubEnd IfWith DatalRecordset.AddNewRecordset.Fields("款号") = Text1.TextRecordset.Fields("品号") = Text2.TextRecordset.Fields("颜色") = Text3.TextRecordset.Fields("色号") = Text4.TextRecordset.Fields("S") = Text5.TextRecordset.Fields("M") = Text6.TextRecordset.Fields("L") = Text7.TextRecordset.Fields("XL") = Text8.TextRecordset.Fields("XXL") = Text9.TextRecordset.Fields("XXL") = Text11.TextRecordset.Fields("库存数") = Text12.TextRecordset.Fields("价格") = Text13.TextRecordset.Fields("分类") = Text14.TextRecordset.Fields("面料") = Text15.TextRecordset.Fields("季节") = Text16.TextRecordset.Fields("年份") = Text10.TextDatal RefreshText1.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.SetFocusEnd SubPrivate Sub Command2_Click()Form2.ShowEnd Sub
查看完整描述

2 回答

?
回首忆惘然

TA贡献1847条经验 获得超11个赞

Recordset 是Datal 的一个属性,所以你的 with 块里应该这么写:
.Recordset.AddNew
.Recordset.Fields("款号") = Text1.Text
另外,with 块需要 End With 来结尾

查看完整回答
反对 回复 2022-08-15
?
吃鸡游戏

TA贡献1829条经验 获得超7个赞

Private Sub GCD(ByRef m As Long, ByRef n As Long)问题出在这里!你调用n1 = GCD(m1, n1)
需要有返回值,sub是没有返回值的,应该是Private function GCD(ByRef m As Long, ByRef n As Long),另外在GSD里要用GCD=返回值才可以!

查看完整回答
反对 回复 2022-08-15
  • 2 回答
  • 0 关注
  • 213 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号