@kidodynomite66,
Posting pictures of your code query SQL is not really helpful. Cannot easily read what the SQL or the code is, so cannot test anything.
Maybe make a copy of the dB, have enough records to illustrate the problem and post it.
I build my queries in VBA different than what your picture shows.
I assign the SQL to a variable, then use CurrentdB.Execute to execute the SQL
Code:
Private Sub btnExecuteQry_Click()
Dim d As DAO.Database
Dim sSQL As String
Set d = CurrentDb
sSQL = "SELECT tblAvailiability.strAvailiability, tblPlantType.IDPlantType"
sSQL = sSQL & " INTO tblTest"
sSQL = sSQL & " FROM tblPlantType INNER JOIN tblAvailiability ON tblPlantType.IDPlantType = tblAvailiability.IDPlantType"
Debug.Print sSQL '<<-- this helps the ensure the SQL is formed properly. (check the immediate window)
d.Execute sSQL, dbFailOnError
Set d = Nothing
End Sub
Alternate coding --
Code:
Private Sub btnExecuteQry_Click()
Dim sSQL As String
sSQL = "SELECT tblAvailiability.strAvailiability, tblPlantType.IDPlantType"
sSQL = sSQL & " INTO tblTest"
sSQL = sSQL & " FROM tblPlantType INNER JOIN tblAvailiability ON tblPlantType.IDPlantType = tblAvailiability.IDPlantType"
Debug.Print sSQL '<<-- this helps the ensure the SQL is formed properly. (check the immediate window)
Currentdb.Execute sSQL, dbFailOnError
End Sub
In your code, it looks like you are missing spaces in front of "INTO" and "FROM".
Code:
DoCmd.RunSQL = "SELECT tblAvailiability.strAvailiability, tblPlantType.IDPlantType" & _
"INTO tblTest" & _
"FROM tblPlantType INNER JOIN tblAvailiability ON tblPlantType.IDPlantType = tblAvailiability.IDPlantType"