Hi all,
Been trying to get this piece of VBA code to work but not sure why it isn't.
This SELECT statement works fine:
However when I try to use this statement to create a new table like this:
I get the "Too few parameters. Expected 1." error.
Why would the syntax for the WHERE criteria not work when going from a SELECT to an INSERT INTO using the same SELECT statement that works independantly as a row source?
Thanks in advance for any guidance.
Been trying to get this piece of VBA code to work but not sure why it isn't.
This SELECT statement works fine:
Code:
strSQL = "SELECT [" & strTmp & "].* FROM [" & strTmp & "] WHERE (([" & strTmp & _
"].[Work center]) Like '*' & [Forms]![frmImport]![txtCode] & '*');"
However when I try to use this statement to create a new table like this:
Code:
strSQL = "INSERT INTO [" & strNewTable & "] SELECT [" & strTmp & "].* FROM [" & strTmp & "] WHERE (([" & strTmp & _
"].[Work center]) Like '*' & [Forms]![frmImport]![txtCode] & '*');"
db.Execute strSQL
I get the "Too few parameters. Expected 1." error.
Why would the syntax for the WHERE criteria not work when going from a SELECT to an INSERT INTO using the same SELECT statement that works independantly as a row source?
Thanks in advance for any guidance.