syntax error in FROM clause - weird

J

joave

Hi:

I get that error in some queries but not others, even if they have the
exact same code. Here is the query:

SELECT RepTable.ID AS ID, RepTable.Name AS Name, 0 AS Sent, 0 AS Entered, 0
AS Connected
FROM RepTable LEFT JOIN [SELECT *
FROM NumberTable
WHERE NumberTable.[Created Date] BETWEEN [Enter Start Date]
AND [Enter End Date]]. AS T ON RepTable.ID = T.[Created User Id]
WHERE T.[Created User Id] IS NULL;

Any help would be appreciated.

Thank you,

Dave
 
J

Jerry Whittle

Name is a reserved word so that might cause strange problems.

http://support.microsoft.com/kb/286335/

You are doing a SELECT * which returns all fields in the subquery where you
really only need the [Created User Id] field.

According to the SQL statement, the parameters are defined which can cause
problems especially if someone would type in an invalid date.

I'm assuming that the [Created Date] field is an actual Date/Time data type.
Otherwise all bets are off.
 
J

joave

Unfortunately the raw data has that field name so I don't have a choice but
to use it as I am importing the data.....any ideas? I tried changing the
field name to "Nam" along with the query field but that still does not work.
Also changed the query from SELECT * to the more selective statement as you
suggested. Nothing works....

Thank you,

Dave

Jerry Whittle said:
Name is a reserved word so that might cause strange problems.

http://support.microsoft.com/kb/286335/

You are doing a SELECT * which returns all fields in the subquery where you
really only need the [Created User Id] field.

According to the SQL statement, the parameters are defined which can cause
problems especially if someone would type in an invalid date.

I'm assuming that the [Created Date] field is an actual Date/Time data type.
Otherwise all bets are off.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


joave said:
Hi:

I get that error in some queries but not others, even if they have the
exact same code. Here is the query:

SELECT RepTable.ID AS ID, RepTable.Name AS Name, 0 AS Sent, 0 AS Entered, 0
AS Connected
FROM RepTable LEFT JOIN [SELECT *
FROM NumberTable
WHERE NumberTable.[Created Date] BETWEEN [Enter Start Date]
AND [Enter End Date]]. AS T ON RepTable.ID = T.[Created User Id]
WHERE T.[Created User Id] IS NULL;

Any help would be appreciated.

Thank you,

Dave
 

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

Top