I'm having a problem adding some records to a table. I have pass a recordset to a subroutine which then finds which codes are included in a field of this recordset. I have if then statements that are checking this. Based on wether the code exists or not, I need to add some information from a tabel called zzz AutoMerge Letters to a table called zzz AutoMerge TEMP I am trying to do this with docmd.runsql, but it doesn't seem to be working. Here is the code:
DoCmd.RunSQL ("INSERT INTO [zzz AutoMerge TEMP] SELECT [zzz AutoMerge Letters].* FROM [zzz AutoMerge Letters] WHERE ((([zzz AutoMerge Letters].Related)='9M') AND (([zzz AutoMerge Letters].Language)="" & Lingua & ""));")
9M is the code that I am looking for. And the lingua is the language the letter is in. Lingua is a global that is assigned earlier in the code. As I have stepped through this code the if then statements work fine, the language variable is working fine also. I cannot find the problem. Any help would be greatly appreciated!
Thanks from Italy.
DoCmd.RunSQL ("INSERT INTO [zzz AutoMerge TEMP] SELECT [zzz AutoMerge Letters].* FROM [zzz AutoMerge Letters] WHERE ((([zzz AutoMerge Letters].Related)='9M') AND (([zzz AutoMerge Letters].Language)="" & Lingua & ""));")
9M is the code that I am looking for. And the lingua is the language the letter is in. Lingua is a global that is assigned earlier in the code. As I have stepped through this code the if then statements work fine, the language variable is working fine also. I cannot find the problem. Any help would be greatly appreciated!
Thanks from Italy.