Dim connection As New adodb.connection
Dim sql As String
Dim years As Integer
years = 2011
So I've got some nice declared variables here. Now I'm going to show the statement that works perfectly, no problems:
sql = "insert into crimeData(reportYear) values(2011)"
connection.Execute sql
Notice I hardcoded in the year. Now, if I try:
sql = "insert into crimeData(reportYear) values(years)"
connection.Execute sql
Substituting the variable name in as a value, I get the error: No value given for one or more required parameters
Admittedly, I'm assuming there's got to be a simple syntax issue, or some meta with variables I'm missing. Please enlighten me. How can I correctly swap in a variable here (so I can use this programatically, as opposed to hard coding in values)