Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88854

Trying to execute a SQL statement from VBA to an Access database, getting a syntax error with the INSERT INTO statement

$
0
0

This is the code:

sqlStr = "INSERT INTO Students (ID, Last Name, First Name, E-mail Address, Student ID, Level, Date of Birth, Home Phone, Address, City, State/Province) VALUES ('"& ID.Value & "','"& lastName.Value & "','"& firstName.Value & "','"& email.Value & "','"& studentID.Value & "','"& birthday.Value & "','"& phone.Value & "','"& address.Value & "','"& city.Value & "','"& state.Value & "');"

DoCmd.RunSQL sqlStr

The .Value variables are coming from text boxes from a userform.


Viewing all articles
Browse latest Browse all 88854


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>