VB 语法错误(操作符丢失)在查询表达式‘‘联系人’)’中
不多说先上图下面上代码OptionCompareDatabaseDimcnAsNewADODB.ConnectionPrivateSubCommand123_Click(...
不多说先上图
下面上代码
Option Compare DatabaseDim cn As New ADODB.Connection
Private Sub Command123_Click() If IsNull(Me.cid) Or IsNull(Me.TextNa) Then
MsgBox "输入信息不全,无法新增", vbExclamation, "提示!"
Exit Sub
End If
Dim rs As New ADODB.Recordset
Dim sql As String
sql = "select * from T_Vendor where VenID='" & Me.cid & "'"
rs.Open sql, cn, adOpenstatic, adLockReadOnly
If Not rs.EOF Then
MsgBox "供应商代号已存在,请核实后重新输入!", vbInformation, "提示!"
Exit Sub
Else
Dim strC, ki As String
ki = Left(Me.TextType, 1)
strC = "insert into T_Vendor(venid,ventype,vendorna,vendoradd,vendortel,vendorfax,vendorEmail,vendorPerson) values ('" & Me![cid] & "','"
strC = strC & ki & "','" & Me.TextNa & "','" & Me.TextAdd & "','" & Me.TextTel & "','" & Me.TextFax & "','" & Me.TextEma & "','"
strC = strC & Me.TextPerson & "')"
cn.Execute strC '执行SQL语句
MsgBox "供应商信息记录新增成功!", vbInformation, "提示!"
End If
rs.Close
Set rs = Nothing
End Sub
求各位大神找碴! 展开
下面上代码
Option Compare DatabaseDim cn As New ADODB.Connection
Private Sub Command123_Click() If IsNull(Me.cid) Or IsNull(Me.TextNa) Then
MsgBox "输入信息不全,无法新增", vbExclamation, "提示!"
Exit Sub
End If
Dim rs As New ADODB.Recordset
Dim sql As String
sql = "select * from T_Vendor where VenID='" & Me.cid & "'"
rs.Open sql, cn, adOpenstatic, adLockReadOnly
If Not rs.EOF Then
MsgBox "供应商代号已存在,请核实后重新输入!", vbInformation, "提示!"
Exit Sub
Else
Dim strC, ki As String
ki = Left(Me.TextType, 1)
strC = "insert into T_Vendor(venid,ventype,vendorna,vendoradd,vendortel,vendorfax,vendorEmail,vendorPerson) values ('" & Me![cid] & "','"
strC = strC & ki & "','" & Me.TextNa & "','" & Me.TextAdd & "','" & Me.TextTel & "','" & Me.TextFax & "','" & Me.TextEma & "','"
strC = strC & Me.TextPerson & "')"
cn.Execute strC '执行SQL语句
MsgBox "供应商信息记录新增成功!", vbInformation, "提示!"
End If
rs.Close
Set rs = Nothing
End Sub
求各位大神找碴! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询