Ok, so something I tried was this:
Code:
Dim sSQL As String
Dim strQuery(1 To 16) As String
strQuery(1) = "Jan"
strQuery(2) = "Feb"
strQuery(3) = "Mar"
strQuery(4) = "Q1"
strQuery(5) = "Apr"
strQuery(6) = "May"
strQuery(7) = "Jun"
strQuery(8) = "Q2"
strQuery(9) = "Jul"
strQuery(10) = "Aug"
strQuery(11) = "Sep"
strQuery(12) = "Q3"
strQuery(13) = "Oct"
strQuery(14) = "Nov"
strQuery(15) = "Dec"
strQuery(16) = "Q4"
For i = 1 To 16
sSQL = "INSERT INTO Initiative ( Main_ID, Initiative_ID, Initiative_Name, Initiative_Requested, Initiative_AoF ) SELECT [2016UnmatchInitiative].Main_ID, [2016UnmatchInitiative].Initiative_ID, [2016UnmatchInitiative].Initiative_Name, [2016UnmatchInitiative].Initiative_Requested, [2016UnmatchInitiative].Initiative_AoF FROM 2016UnmatchInitiative WHERE ((([2016UnmatchInitiative].Main_ID) Like " * " & chr(34) & strQuery(i) & chr(34) " * "));"
DoCmd.RunSQL sSQL
Next i
I get a run time code in the sSQL string text designation (highlighted in bold) that says Run-Time error 13 "TYPE MISMATCH"...
Any idea as to why? Probably because of my use of chr(34), but when I write it another way... I get the same error (show below):
Code:
sSQL = "INSERT INTO Initiative ( Main_ID, Initiative_ID, Initiative_Name, Initiative_Requested, Initiative_AoF ) SELECT [2016UnmatchInitiative].Main_ID, [2016UnmatchInitiative].Initiative_ID, [2016UnmatchInitiative].Initiative_Name, [2016UnmatchInitiative].Initiative_Requested, [2016UnmatchInitiative].Initiative_AoF FROM 2016UnmatchInitiative WHERE ((([2016UnmatchInitiative].Main_ID) Like " * "'" & strQuery(i) & "'" * "));"