Sourabh Agrawal
Sourabh Agrawal

Reputation: 856

Runtime error 3134 in visual basic

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 & "')"

I am new to visual basic and access, trying to insert a row on button click in access, could not figure out the syntax error in this visual basic code.

Thanks in advance

Upvotes: 1

Views: 178

Answers (3)

Ronnie Jimenez
Ronnie Jimenez

Reputation: 67

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 & "')"

Upvotes: 1

ccarpenter32
ccarpenter32

Reputation: 1077

Actually, I see another issue now. MS Access does not accept E-mail as a column name. Use [E-mail]. Assuming there are no other issues, that will likely solve the problem.

Edit:

As a futher explanation, this is because of the '-' (dash) in E-mail. The same would apply for any column that starts with a number (such as "1234Column").

Upvotes: 1

Gustav
Gustav

Reputation: 55831

Password is a reserved word, so use: [Password]

Upvotes: 3

Related Questions