Copied query won't run.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following query working just fine but it has been reading a test
make table.

SELECT Turn_around_report_test.ORDER_ID,
Sum(Datediff("n",Turn_around_report_test.STATUS_DT,(SELECT Min(T.[STATUS_DT])
FROM Turn_around_report_test AS T WHERE
(((T.ORDER_ID)=[Turn_around_report_test].[ORDER_ID]) AND
((T.STATUS_DT)>[Turn_around_report_test].[STATUS_DT]) AND
((T.ORDER_STATUS_TYPE_ID)=7))))) AS TimeDiff
FROM Turn_around_report_test
WHERE (((Turn_around_report_test.ORDER_STATUS_TYPE_ID)=10))
GROUP BY Turn_around_report_test.ORDER_ID, Turn_around_report_test.STATUS_DT;

Now I want to copy the query and have it use a different make table. So I
copied it and did a search and replace to replace the table name from
Turn_around_report_test to TblSnPnl0048-01. Now when I try to run the query
I get an error that says their is a missing operator in the query expression
and makes reference to SELECT TblSnPnl0048-01.ORDER_ID.

Why is this giving me trouble? It's the same exact query as the original
except the table name is different.
 
I'd imagine it’s the hyphen in the table name that's the problem. Wrapping
it in brackets should cure it:

SELECT [TblSnPnl0048-01].ORDER_ID …..

Use [TblSnPnl0048-01] in the search and replace to make sure all instances
of the name are bracketed.

Ken Sheridan
Stafford, England
 
That fixed it. Thanks!

Ken Sheridan said:
I'd imagine it’s the hyphen in the table name that's the problem. Wrapping
it in brackets should cure it:

SELECT [TblSnPnl0048-01].ORDER_ID …..

Use [TblSnPnl0048-01] in the search and replace to make sure all instances
of the name are bracketed.

Ken Sheridan
Stafford, England

Jim Moberg said:
I have the following query working just fine but it has been reading a test
make table.

SELECT Turn_around_report_test.ORDER_ID,
Sum(Datediff("n",Turn_around_report_test.STATUS_DT,(SELECT Min(T.[STATUS_DT])
FROM Turn_around_report_test AS T WHERE
(((T.ORDER_ID)=[Turn_around_report_test].[ORDER_ID]) AND
((T.STATUS_DT)>[Turn_around_report_test].[STATUS_DT]) AND
((T.ORDER_STATUS_TYPE_ID)=7))))) AS TimeDiff
FROM Turn_around_report_test
WHERE (((Turn_around_report_test.ORDER_STATUS_TYPE_ID)=10))
GROUP BY Turn_around_report_test.ORDER_ID, Turn_around_report_test.STATUS_DT;

Now I want to copy the query and have it use a different make table. So I
copied it and did a search and replace to replace the table name from
Turn_around_report_test to TblSnPnl0048-01. Now when I try to run the query
I get an error that says their is a missing operator in the query expression
and makes reference to SELECT TblSnPnl0048-01.ORDER_ID.

Why is this giving me trouble? It's the same exact query as the original
except the table name is different.
 

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

Back
Top