Connecting Tech Pros Worldwide Forums | Help | Site Map

Runtime error 3075 with SQL statement

Newbie
 
Join Date: Jan 2008
Posts: 2
#1: Jan 7 '08
"SELECT [HPD:HelpDesk].[Case-ID+], [HPD:HelpDesk].Category
INTO tblSiteGroupActiveTicketRawData FROM [HPD:HelpDesk
WHERE (([HPD:HelpDesk].Base = 'AAAA') OR ([HPD:HelpDesk].Base = 'BBBB')) AND ([HPD:HelpDesk].Status != 'Closed');"

Above SQL string fails with a runtime error 3075 syntax error (operator missing). I cannot figure this one out. Any assistance would be appreciated.
JKing's Avatar
Moderator
 
Join Date: Jun 2007
Location: Niagara Falls, Ontario
Posts: 557
#2: Jan 7 '08

re: Runtime error 3075 with SQL statement


Quote:

Originally Posted by MARTINQC

"SELECT [HPD:HelpDesk].[Case-ID+], [HPD:HelpDesk].Category
INTO tblSiteGroupActiveTicketRawData FROM [HPD:HelpDesk
WHERE (([HPD:HelpDesk].Base = 'AAAA') OR ([HPD:HelpDesk].Base = 'BBBB')) AND ([HPD:HelpDesk].Status != 'Closed');"

Above SQL string fails with a runtime error 3075 syntax error (operator missing). I cannot figure this one out. Any assistance would be appreciated.


Hey there,

At a quick glance it looks like you're missing a closing bracket on your FROM line.

"SELECT [HPD:HelpDesk].[Case-ID+], [HPD:HelpDesk].Category
INTO tblSiteGroupActiveTicketRawData
FROM [HPD:HelpDesk]
WHERE (([HPD:HelpDesk].Base = 'AAAA') OR ([HPD:HelpDesk].Base = 'BBBB')) AND ([HPD:HelpDesk].Status != 'Closed');"
Newbie
 
Join Date: Jan 2008
Posts: 2
#3: Jan 7 '08

re: Runtime error 3075 with SQL statement


I'm pretty sure that is a typo on my part in the forum as it is there in the actual string.

SELECT [HPD:HelpDesk].[Case-ID+], [HPD:HelpDesk].Category INTO tblSiteGroupActiveTicketRawData FROM [HPD:HelpDesk] WHERE (([HPD:HelpDesk].Base = 'AAAA') OR ([HPD:HelpDesk].Base = 'BBBB')) AND ([HPD:HelpDesk].Status != 'Closed');

I think I erased the bracket when I formatted it for easier reading. The string above is a direct cut/paste from the query.
jaxjagfan's Avatar
Expert
 
Join Date: Dec 2007
Location: Jax, FL
Posts: 253
#4: Jan 7 '08

re: Runtime error 3075 with SQL statement


Quote:

Originally Posted by MARTINQC

I'm pretty sure that is a typo on my part in the forum as it is there in the actual string.

SELECT [HPD:HelpDesk].[Case-ID+], [HPD:HelpDesk].Category INTO tblSiteGroupActiveTicketRawData FROM [HPD:HelpDesk] WHERE (([HPD:HelpDesk].Base = 'AAAA') OR ([HPD:HelpDesk].Base = 'BBBB')) AND ([HPD:HelpDesk].Status != 'Closed');

I think I erased the bracket when I formatted it for easier reading. The string above is a direct cut/paste from the query.

Is "Status !" a field name?

SELECT [HPD:HelpDesk].[Case-ID+], [HPD:HelpDesk].Category INTO tblSiteGroupActiveTicketRawData FROM [HPD:HelpDesk] WHERE ([HPD:HelpDesk].Base IN ('AAAA', 'BBBB')) AND ([HPD:HelpDesk].[Status !] = 'Closed');

Just a habit but changed the OR to IN. Also make sure those same columns exist in "tblSiteGroupActiveTicketRawData " as they are in "HPD:HelpDesk". If not use "AS" to rename the "HPD:HelpDesk" columns.

The special characters (:,-,+,!) are not good to have as field names and makes things a bit more difficult to develop reports, queries, and to reference elsewhere.
JKing's Avatar
Moderator
 
Join Date: Jun 2007
Location: Niagara Falls, Ontario
Posts: 557
#5: Jan 7 '08

re: Runtime error 3075 with SQL statement


Quote:

Originally Posted by MARTINQC

I'm pretty sure that is a typo on my part in the forum as it is there in the actual string.

SELECT [HPD:HelpDesk].[Case-ID+], [HPD:HelpDesk].Category INTO tblSiteGroupActiveTicketRawData FROM [HPD:HelpDesk] WHERE (([HPD:HelpDesk].Base = 'AAAA') OR ([HPD:HelpDesk].Base = 'BBBB')) AND ([HPD:HelpDesk].Status != 'Closed');

I think I erased the bracket when I formatted it for easier reading. The string above is a direct cut/paste from the query.

Try this..

Expand|Select|Wrap|Line Numbers
  1. SELECT [HPD:HelpDesk].[Case-ID+], [HPD:HelpDesk].Category INTO tblSiteGroupActiveTicketRawData FROM [HPD:HelpDesk] WHERE (([HPD:HelpDesk].Base = 'AAAA') OR ([HPD:HelpDesk].Base = 'BBBB')) AND ([HPD:HelpDesk].Status NOT IN ('Closed'));
  2.  
JKing's Avatar
Moderator
 
Join Date: Jun 2007
Location: Niagara Falls, Ontario
Posts: 557
#6: Jan 8 '08

re: Runtime error 3075 with SQL statement


The != operator is not recognized as being a proper operator.

The correct syntax for this operator is <>.

Example:
Expand|Select|Wrap|Line Numbers
  1. SELECT firstName, lastName
  2. FROM tblPerson
  3. WHERE firstName <> 'Bob'
  4.  
Reply


Similar Microsoft Access / VBA bytes