MichaelRed
Programmer
I have generated a number of queries to transform some data (tables) in one database into similar tables in another database. All of the queries are generated as sql strings in a module. Most of them work just fine. Two of them do not. They do not generate any errors. When I output the SQL strings (via Debug) in the course of execution and copy these into the query grid and execute them - THEY WORK as EXPECTED!!!
I have, after pasting the sql string into the sql view of the query grid, set the mode to 'design' and resetting the view to 'SQL' copied the sql string and compared it to the generated sql string - with no differences.
I then changed the view to the grid, executed the query (with apparently good results), and again reverted to the SQL view, copied it and compared to the originally generated strin - Again without any difference.
Does anyone here know anything else I can try?
Code to generate one of the strings:
the generated string:
Help?
MichaelRed
I have, after pasting the sql string into the sql view of the query grid, set the mode to 'design' and resetting the view to 'SQL' copied the sql string and compared it to the generated sql string - with no differences.
I then changed the view to the grid, executed the query (with apparently good results), and again reverted to the SQL view, copied it and compared to the originally generated strin - Again without any difference.
Does anyone here know anything else I can try?
Code to generate one of the strings:
Code:
strSQL = "INSERT INTO " & strDestTblName & " " _
& "( " & strDestFields & " ) "
'Special Query, Uses to get all at once *****************************
strSQL = strSQL & "SELECT tblTransactions.TranReason, " _
& "tblTransactions.ProductNumber, " _
& "IIF (Left([SerialNo], 2) = " & Quo & "NA" & Quo & ", " & Quo _
& "" & Quo & ", SerialNo) As SerNo, " _
& "Sum(tblTransactions.QPulled) AS QAsgn " _
& "FROM tblTransactions In " & Chr(39) & dbs_Bos.Name & Chr(39) & " " _
& "Where " _
& "TranReason Not LIke " & Quo & "AAT*" & Quo & " And " _
& "QPulled <> 0 " & " " _
& "GROUP BY tblTransactions.TranReason, " _
& "tblTransactions.ProductNumber, SerialNo " _
& "HAVING ((tblTransactions.TranReason) in (Select JobId From tblJobs));"
the generated string:
Code:
INSERT INTO tblTransAct_Service ( [TranReason], [ProductNumber], [SerNo], [QAsgn] ) SELECT tblTransactions.TranReason, tblTransactions.ProductNumber, IIF (Left([SerialNo], 2) = "NA", "", SerialNo) As SerNo, Sum(tblTransactions.QPulled) AS QAsgn FROM tblTransactions In 'L:\ihs\BosProduction\BOS_BE\ihs_data.mdb' Where TranReason Not LIke "AAT*" And QPulled <> 0 GROUP BY tblTransactions.TranReason, tblTransactions.ProductNumber, SerialNo HAVING ((tblTransactions.TranReason) in (Select JobId From tblJobs));
Help?
MichaelRed