PDA

View Full Version : Can't Populate Recordset due to SQL code



taporctv
07-11-2007, 07:25 AM
The SQL code runs fine in access. But when I run it through excel to populate a recordset is says join not supported. Here's my code.

cmd.CommandText = "SELECT DISTINCT SFtoFD.NAME1 AS [SV-4 Decomp name], SFtoFD.NAME2 AS [SF from Func Decomp], " _
& "[SV-5].NAME1 AS [SF from SV-5], SFtoSV4.NAME1 AS [SV-4 Data Flow name], SFtoSV4.NAME2 AS [SF from Data Flow]" _
& "FROM ([SV-5] LEFT JOIN SFtoFD ON [SV-5].NAME1=SFtoFD.NAME2) LEFT JOIN SFtoSV4 ON [SV-5].NAME1=SFtoSV4.NAME2" _
& "WHERE ([SV-5].Name1 AND SFtoFD.NAME2) IS NULL AND ([SV-5].Name1 AND SFtoSV4.NAME2) IS NULL;"

mdmackillop
07-11-2007, 10:42 AM
You're missing spaces before the end quotes in lines 2 & 3 resulting in, for line 3

NAME1=SFtoSV4.NAME2WHERE