Number of columns error is query

J

John

Hi All,

First Happy New Year to all,

Second: I have a query that was working fine. The database admin
changed one of the fields in a linked table from number to type string.
After refreshing the link I get this error:
"The number of columns in the two selected tables or queries of a union
do not match"

I have also lost the design view on the query. It gives an error
stating it can not show the design view because the fields have
changed.
Here is the query:
SELECT tmp.PC_ID, tmp.ClientAFE, tmp.PENumber,
dbo_tlkpClientName.ClientName, [ProjectTitle] & ' ' & [Project_Abb] AS
[Desc], tmp.ClientNameID, dbo_tlkpStatus.Status, tmp.ProjectTitle,
tmp.ProjectTypeID, tmp.Table_Name INTO tblPC_update
FROM ((([SELECT 'PC' as Table_Name, PC.* FROM DBO_PROJECTCONTROL AS PC

UNION ALL SELECT 'tblPC' as Table_Name, tblPC.* FROM tblPC
as tblPC]. AS tmp INNER JOIN dbo_tlkpClientName ON tmp.ClientNameID =
dbo_tlkpClientName.CLientNameID) INNER JOIN dbo_tlkpProjectType ON
tmp.ProjectTypeID = dbo_tlkpProjectType.ProjectTypeID) INNER JOIN
dbo_tlkpProjectArea ON tmp.PAreaID = dbo_tlkpProjectArea.PAreaID) INNER
JOIN dbo_tlkpStatus ON tmp.Status_ID = dbo_tlkpStatus.Status_ID
GROUP BY tmp.PC_ID, tmp.ClientAFE, tmp.PENumber,
dbo_tlkpClientName.ClientName, [ProjectTitle] & ' ' & [Project_Abb],
tmp.ClientNameID, dbo_tlkpStatus.Status, tmp.ProjectTitle,
tmp.ProjectTypeID, tmp.Table_Name
ORDER BY tmp.PC_ID, tmp.Table_Name;

Before this when all was working in design view I had the temp table
showing up with fields in it. Now there are no fields in the temp
table. It looks like an empty table.

Third: thanks for taking the time to help me.
 
J

John

John said:
Hi All,

First Happy New Year to all,

Second: I have a query that was working fine. The database admin
changed one of the fields in a linked table from number to type string.
After refreshing the link I get this error:
"The number of columns in the two selected tables or queries of a union
do not match"

I have also lost the design view on the query. It gives an error
stating it can not show the design view because the fields have
changed.
Here is the query:
SELECT tmp.PC_ID, tmp.ClientAFE, tmp.PENumber,
dbo_tlkpClientName.ClientName, [ProjectTitle] & ' ' & [Project_Abb] AS
[Desc], tmp.ClientNameID, dbo_tlkpStatus.Status, tmp.ProjectTitle,
tmp.ProjectTypeID, tmp.Table_Name INTO tblPC_update
FROM ((([SELECT 'PC' as Table_Name, PC.* FROM DBO_PROJECTCONTROL AS PC

UNION ALL SELECT 'tblPC' as Table_Name, tblPC.* FROM tblPC
as tblPC]. AS tmp INNER JOIN dbo_tlkpClientName ON tmp.ClientNameID =
dbo_tlkpClientName.CLientNameID) INNER JOIN dbo_tlkpProjectType ON
tmp.ProjectTypeID = dbo_tlkpProjectType.ProjectTypeID) INNER JOIN
dbo_tlkpProjectArea ON tmp.PAreaID = dbo_tlkpProjectArea.PAreaID) INNER
JOIN dbo_tlkpStatus ON tmp.Status_ID = dbo_tlkpStatus.Status_ID
GROUP BY tmp.PC_ID, tmp.ClientAFE, tmp.PENumber,
dbo_tlkpClientName.ClientName, [ProjectTitle] & ' ' & [Project_Abb],
tmp.ClientNameID, dbo_tlkpStatus.Status, tmp.ProjectTitle,
tmp.ProjectTypeID, tmp.Table_Name
ORDER BY tmp.PC_ID, tmp.Table_Name;

Before this when all was working in design view I had the temp table
showing up with fields in it. Now there are no fields in the temp
table. It looks like an empty table.

Third: thanks for taking the time to help me.

Thanks but I got help from another group and got it figured out
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Number of columns error 3

Top