Query error - The number of columns in the two selected tables or queries of a union

e3k

New member
Local time
Tomorrow, 00:01
Joined
Dec 10, 2013
Messages
2
Hi,

I'm new to Access. We have a database that was created years ago and has been working fine. Now suddendly we get the following error message on a query.

"The number of columns in the two selected tables or queries of a union query do not match"

This is the code

SELECT [TimeSheets All].[Job Number], [TimeSheets All].Date, [TimeSheets All].Details, [TimeSheets All].[Start Time], [TimeSheets All].[End Time], [TimeSheets All].[Unbillable hours], [TimeSheets All].Who, *
FROM [TimeSheets All]
WHERE ((([TimeSheets All].[Job Number]) Like [Forms]![Search]![Job Number]))
ORDER BY [TimeSheets All].[Job Number], [TimeSheets All].Date;

Can anyone please help.
 
Query error - The number of columns in the two selected tables or queries of ...

Why do you select certain fields and then * to bring theme all in?

Where is the UNION part?

I'd wrap Date in [ ] also as it's a reserved word.
 
Re: Query error - The number of columns in the two selected tables or queries of ...

Thanks for your help. I didn't write the code, so not sure why the * is there. I couldn't see the UNION part either which is why the error confised me.

I tried removing the * and wraped Date in [ ] but still get the same error.

Why do you select certain fields and then * to bring theme all in?

Where is the UNION part?

I'd wrap Date in [ ] also as it's a reserved word.
 
Create a new query in the QBE window, choose SQL view put the below in, and run the query, (remember to have the form [Search] open and a number in [Job Number], else take a way the WHERE part.):
Code:
SELECT [TimeSheets All].[Job Number], [TimeSheets All].Date, [TimeSheets  All].Details, [TimeSheets All].[Start Time], [TimeSheets All].[End  Time], [TimeSheets All].[Unbillable hours], [TimeSheets All].Who 
FROM [TimeSheets All]
WHERE ((([TimeSheets All].[Job Number]) Like [Forms]![Search]![Job Number]))
ORDER BY [TimeSheets All].[Job Number], [TimeSheets All].Date;
 

Users who are viewing this thread

Back
Top Bottom