Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you find what happen to this code?

Status
Not open for further replies.

siulonbow

Technical User
Feb 4, 2009
2
US
I am trying to find duplicate customer's name, but my code show an error when i let it run. please help.

The column that i use are these: customer (text), Field13(text field) show date when the customer submit questions, Survey Type, Svc Acct Num. I am trying to write a code that can help me look for duplicate customer. The criteria is that 1) the customer can't submit questions within 12 months (Field 13), 2) Survey type cannot be duplicated, 3) svc Acct numb can't be duplicate.

My code is as follow:
SELECT t1.* FROM Surveytest2007 as T1
INNER JOIN Surveytest2007 as T2
ON T2.Customer=T1.Customer
AND T2.Survey Type = T1.Survey Type
AND T2.ID <> T1.ID
WHERE Abs(DateDiff("m", Cdate(T1.Field13), CDate(T2.Field13))) <= 12


The problem is that i will receive Syntax error(missing operator) in query expression
 
At a minimum you naming convention is poor fields names should never have a space between them

T2.Survey Type = T1.Survey Type

That will through an error

T2.[Survey Type]
 
Should be throw an error not through an error. Poor spelling. Do yourself a favor and never use names with spaces or reserved words like (Date, Name, Sum, etc.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top