我需要用vba update语句帮助解决我的问题:
在我的表单中,我有一个点击表单,当我点击它时执行此程序:
Dim strSQL As String
Dim rst As New ADODB.Recordset
strSQL = "UPDATE dbo.Firma_test SET Fax = " & Me![subforma_companie].Form!fax & _
"[E-mail] = " & Me![subforma_companie].Form!email & _
"WHERE Company_Code = " & Me![subforma_companie].Form!Cod
当我执行时,我告诉我他没有看到电子邮件字段,我该怎么办?
答案 0 :(得分:2)
在WHERE
子句之前需要一个空格:
strSQL = "UPDATE dbo.Firma_test SET Fax = " & Me![subforma_companie].Form!fax & _
", [E-mail] = '" & Me![subforma_companie].Form!email & _
"' WHERE Company_Code = " & Me![subforma_companie].Form!Cod
此外,您可能需要考虑某种形式的SQL Injection
预防,只是让用户在DROP TABLE db.Firma_test
subforma_companie form