I have done VBCode in Access 2003 for years and am finally making the jump and am coding in Access 2013. I am getting the error
The expression you entered has an invalid . (dot) or ! operator or invalid parenthesis.
and I cannot figure out why.
Here is my code:
Function CreateUSHistory()
mySQL = ""
mySQL = "INSERT INTO [US History] ( Student_ID, Period, Teacher ) "
mySQL = mySQL & "SELECT AllStudents.Student_ID, Mid$([AllStudents]![Col1_Class_Name_4],2,1) AS Period, AllStudents!Col1_Teacher_4 "
mySQL = mySQL & "FROM AllStudents "
mySQL = mySQL & "WHERE (((AllStudents.Col1_Class_Name_4) Like '*US History*'));"
'For x = 1 To 13
' GenerateSQL mySQL, "US History", "*US History*", x
RunActionSQL mySQL
'Next x
End Function
The SQL is copied from a query that does run successfully. I modified the " to '. The loop is disabled until I can get the simple query to run and then the function will run 13 queries in a row with the counter changing.
Scott
The expression you entered has an invalid . (dot) or ! operator or invalid parenthesis.
and I cannot figure out why.
Here is my code:
Function CreateUSHistory()
mySQL = ""
mySQL = "INSERT INTO [US History] ( Student_ID, Period, Teacher ) "
mySQL = mySQL & "SELECT AllStudents.Student_ID, Mid$([AllStudents]![Col1_Class_Name_4],2,1) AS Period, AllStudents!Col1_Teacher_4 "
mySQL = mySQL & "FROM AllStudents "
mySQL = mySQL & "WHERE (((AllStudents.Col1_Class_Name_4) Like '*US History*'));"
'For x = 1 To 13
' GenerateSQL mySQL, "US History", "*US History*", x
RunActionSQL mySQL
'Next x
End Function
The SQL is copied from a query that does run successfully. I modified the " to '. The loop is disabled until I can get the simple query to run and then the function will run 13 queries in a row with the counter changing.
Scott