CurrentDb.Execute "INSERT INTO Customer(FirstName, LastName, E-mail, Password, PhoneNumber, Address, City, State, Zipcode) " & " VALUES('" & Me.FirstName & "','" & Me.LastName & "','" & Me.E_mail & "','" & Me.Password & "', " & Me.PhoneNumber & ",'" & Me.Address & "','" & Me.City & "', '" & Me.ZipCode & "')"
我是visual basic和access的新手,试图在按钮点击访问时插入一行,无法弄清楚这个可视化基本代码中的语法错误。
提前致谢
答案 0 :(得分:3)
密码是保留字,因此请使用:[密码]
答案 1 :(得分:1)
实际上,我现在看到了另一个问题。 MS Access不接受电子邮件作为列名。使用[电子邮件]。假设没有其他问题,这可能会解决问题。
编辑:
作为进一步的解释,这是因为电子邮件中的“ - ”(短划线)。这同样适用于以数字开头的任何列(例如“1234Column”)。
答案 2 :(得分:1)
CurrentDb.Execute "INSERT INTO Customer(FirstName, LastName, E-mail, Password, PhoneNumber, Address, City, State, Zipcode) VALUES('" & Me.FirstName & "','" & Me.LastName & "','" & Me.E_mail & "','" & Me.Password & "', " & Me.PhoneNumber & ",'" & Me.Address & "','" & Me.City & "', '" & Me.ZipCode & "')"