I have the code that I have adapted to produce a random sample but which all work well until the following piece of code
' Sort the data by the random number and move top 50 into a new table
strTableName = "tblRandom_" & Format(Date, "ddmmmyyyy")
strSql = "SELECT TOP 50 tblTemp.NINO,tblTemp.Surname,tblForename_1" & _
"INTO" & strTableName & " " & _
"FROM tblTemp " & _
"ORDER BY tblTemp.RandomNumber;"
DoCmd.SetWarnings False
DoCmd.RunSQL strSql
DoCmd.SetWarnings True
what it should do is create a new talbe and take the top 50 records from a temporary table and append them to the new table Random. I receive a run time error 2342 which states
A RunSQL action requires an argument consisting of an SQL statement. Now as this code is adapted I was wondering were I am going wrong
Thanks for any help
' Sort the data by the random number and move top 50 into a new table
strTableName = "tblRandom_" & Format(Date, "ddmmmyyyy")
strSql = "SELECT TOP 50 tblTemp.NINO,tblTemp.Surname,tblForename_1" & _
"INTO" & strTableName & " " & _
"FROM tblTemp " & _
"ORDER BY tblTemp.RandomNumber;"
DoCmd.SetWarnings False
DoCmd.RunSQL strSql
DoCmd.SetWarnings True
what it should do is create a new talbe and take the top 50 records from a temporary table and append them to the new table Random. I receive a run time error 2342 which states
A RunSQL action requires an argument consisting of an SQL statement. Now as this code is adapted I was wondering were I am going wrong
Thanks for any help