This is VBA from Excel. I want to know how to increment the [ID] for each value of the range.
I have tried "NULL".
I have tried adding "n=n+1" after the "for each" and "thisSQL = "INSERT INTO... VALUES (" & n & ",..."
Code:
For Each value In Range("D5:D" & Cells(Rows.Count, "D").End(xlUp).Row)
accDate = Cells(value.Row, 1)
accDesc = Cells(value.Row, 2)
accData = Cells(value.Row, 3)
thisSQL = "INSERT INTO [Table1] ([ID], [Date], [Desc], [Data]) VALUES ("What goes here? ", #" & Format(CDate(accDate), "MM/DD/YY") & "#, '" & accDesc & "', " & accData & ");"
conn.Execute CommandText:=thisSQL
Next