I was given some assistance by 'ItsMe' to help get my code running correctly.
I have a code attached to a check box that when pressed will run a create table query and then export
that table to an excel spread sheet.
All was working sweetly until I added another line to the query SQL. (ORDER BY).
I receive a run-time error '3464': Data type mismatch in criteria expression.
Code:
Private Sub Check153_Click()
Dim strSQL As String
strSQL = "SELECT tbl_Scores.RAN, tbl_Scores.TEAM, tbl_Scores.DVN, tbl_Scores.FOR, tbl_Scores.RLT, tbl_Scores.AGT INTO 1974 " & _
"FROM tbl_Scores " & _
"WHERE (((tbl_Scores.RAN)<19) AND ((tbl_Scores.YEAR)=1974) AND ((tbl_Scores.AGE)=10)) " & _
"ORDER BY tbl_Scores.RAN, tbl_Scores.TEAM;"
Debug.Print strSQL
DoCmd.RunSQL strSQL
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "1974", "C:\Documents\U10_1974-1979.xlsm", True, "_1974"
End Sub
When I press Debug the line
Code:
DoCmd.RunSQL strSQL
is highlighted.
What have I done wrong this time?