OldIDCarnet is a variable set elsewhere in the code. What I have here puts the variable name as a literal in the query, not the data it contains. I looked at your example in 264717, but couldn’t get that to function. Where am I going wrong, please?
‘ execute query to change IDCarnetOld to IDCarnet, the new ID.
strSQL = “SELECT tblSumaPorFacturaHistoria.IdCarnet INTO TestVBAQry FROM tblSumaPorFacturaHistoria WHERE (((tblSumaPorFacturaHistoria.IdCarnet)=OldIDCarnet));”
Set qdf = dbs.CreateQueryDef(“”, strSQL)