Hey,
Okay, i have qry A and qry B..and i want qry C that would do qry A union qry B. The problem is that.. qry A selects 4 cols from tables and qry B select only 3 cols from tables. Both qry A and qry B are aggregate queries. The union of these two queries would have worked great if qry B had 4 cols as well..but it doesn't. When i do a union of qry A and qry B it says they don't have equal number of cols. Is there any way to solve this problem? how can i combine results of qry A and qry B in one table and the rows in qry B not having the 4th col; i would just like those rows to be blank for qry B results. Hope this makes sense. below is the code
Any help will be just great.
THANK YOU!
Okay, i have qry A and qry B..and i want qry C that would do qry A union qry B. The problem is that.. qry A selects 4 cols from tables and qry B select only 3 cols from tables. Both qry A and qry B are aggregate queries. The union of these two queries would have worked great if qry B had 4 cols as well..but it doesn't. When i do a union of qry A and qry B it says they don't have equal number of cols. Is there any way to solve this problem? how can i combine results of qry A and qry B in one table and the rows in qry B not having the 4th col; i would just like those rows to be blank for qry B results. Hope this makes sense. below is the code
Code:
[B] QRY A [/B]
StrSQL = "SELECT t1.[Error Code],t2.Description,COUNT(t1.[PCB SS #]) AS TtlNumberFailed " & _
" FROM [PCB Incoming_Production Results] AS t1, [PCB Error Codes] as t2 " & _
" WHERE t1.[Error Code]<> 'Pass' AND t1.[Error Code]<> 'n/a' AND t1.[Error Code]= t2.[Code] AND Manufacturer = """ & Me.txtMfg & """ And [Date] Between #" & _
Me.txtMfgStart & "# AND #" & Me.txtMfgEnd & "# GROUP BY t1.[Error Code],t2.Description; "
[B] QRY B [/B]
StrSQL = "SELECT (t1.[Error Code]), count (t1.[Error Code])As TtlNumberFailed " & _
"FROM [PCB Incoming_Production Results] AS t1 LEFT JOIN [PCB Error Codes] ON t1.[Error Code] = [PCB Error Codes].CODE " & _
"WHERE ((([PCB Error Codes].Code) Is Null)) GROUP BY (t1.[Error Code]); "
[B]QRY C[/B]
StrSQL = "SELECT * FROM qryNoFailedPCBByET UNION SELECT * FROM qryNotHaveED; "
Any help will be just great.
THANK YOU!