这个问题我经常遇见 拜托了
这是截图
具体的代码如下:
------------------------------------------------------------
Private Sub cmdSave_Click()
If 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 Combo1.Text = "" Or Combo3.Text = "" Or DTPicker1.Value = "" Or DTPicker2.Value = "" Or DTPicker3.Value = "" Or DTPicker4.Value = "" Then
MsgBox "输入信息不允许空值", , "系统提示"
Exit Sub
End If
If Not IsNumeric(Trim(Text10.Text)) Or Not IsNumeric(Trim(Text11.Text)) Then
MsgBox "请输入正确的信息!", , "系统提示"
Exit Sub
End If
Adodc3.RecordSource = "select * from tab_yzinfo where 业主代号='" & Text5.Text & "'"
Adodc3.Refresh
If Adodc3.Recordset.RecordCount > 0 Then
If Text5.Text = Adodc1.Recordset.Fields("业主代号") Then
MsgBox "已有业主信息!", , "系统提示"
Exit Sub
End If
Else
If Text5.Text <> Adodc3.Recordset.Fields("业主代号") Then
Set adors = cn.Execute("insert into tab_rkinfo (人口编号,姓名,性别,出生日期,文化程度,籍贯,国籍,婚姻状况,工作单位,职业,职务,职称,家庭电话,单位电话,手机,家庭住址,小区名称,大楼名称,房间号,身份证号,户口所在地,暂住证号,房间编号,备注,与户主关系)values('" & Text19 & "','" & Text6 & "','" & Combo2 & "','" & DTPicker1 & "','" & Combo5 & "','" & Combo4 & "','" & Combo3 & "','" & Combo1 & "','" & Text15 & "','" & Combo6 & "','" & Text8 & "','" & Combo7 & "','" & Text14 & "','" & Text17 & "','" & Text16 & "','" & Text1 & "','" & Text2 & "','" & Text3 & "','" & Text7 & "','" & Text7 & "','" & Text13 & "','" & Text9 & "','" & Text4 & "','" & Text18 & "','" & "户主" & "')")
Set adors = cn.Execute("insert into tab_yzinfo values('" & Text5 & "','" & Text6 & "','" & DTPicker1.Value & "','" & Combo1 & "','" & Combo2 & "','" & Combo3 & "','" & Combo4 & "','" & Combo5 & "','" & Combo6 & "','" & Combo7 & "','" & Combo8 & "','" & Text7 & "','" & Text8 & "','" & Text9 & "','" & Text10 & "','" & Text11 & "','" & Text12 & "','" & Text13 & "','" & "text14" & "','" & Text15 & "','" & Text16 & "','" & DTPicker2.Value & "','" & DTPicker3 & "','" & Text17.Text & "','" & DTPicker4.Value & "','" & DTPicker5.Value & "','" & Text18 & "','" & Text1 & "','" & Text2 & "','" & Text4 & "') ")
MsgBox "数据保存成功!", , "系统提示"
End If
End If
Adodc2.Refresh
Set DataGrid1.DataSource = Adodc2
End Sub
---------------------------------------------------------------------------
报错的地方已经用颜色标出 拜托了