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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mising Operator Error 3075

Status
Not open for further replies.

anon1971

Programmer
Aug 9, 2008
88
US
Can anyone tell me why I get the 3075 error in this code I am seeing cross eyed at this point? Thanks

DoCmd.RunSQL "UPDATE MailingList2 SET MailingList2.SS = True WHERE (((MailingList2.Address)having count(*) > 1)));", -1
 
I see a couple of problems here.

First, you are setting a column to the value True. Microsoft SQL Server would not recognize this. For Booleans, you should use 1 or 0.

[tt]Set MailingList2.SS = 1[/tt]

The biggest problem here is that you have a WHERE clause in your query, but the where condition is not valid. You have:

[tt]WHERE (((MailingList2.Address)having count(*) > 1)))[/tt]

What is MailingList2.Address doing in there? You are not comparing it to anything. You are missing the comparison operator (just like the error message is telling you).



-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Ok I am trying to set the value to true if it finds more than one duplacate address?
 
If you're using SQL 2005 and up, use this:
Code:
;with cte as (select PK, count(Address) over (partition by SomeField) as cntAddresses from MailingList2)

update cte set SS = 'true' where cntAddresses > 1

Which field in the mailinglist2 table should be a group field? You will need to put this field(s) into PARTITION clause.

PluralSight Learning Library
 
thanks for the response now its giveing a 3319 error on union query:


DoCmd.RunSQL "(; with cte as select PK, count(Address) over (partition by Address) as cntAddresses from MailingList2)update cte set SS = 'true' where cntAddresses > 1"
 
Remove ( at the beginning of the string.

Code:
DoCmd.RunSQL "; with cte as (select PK, count(Address) over (partition by Address) as cntAddresses from MailingList2) update cte set SS = 'true' where cntAddresses > 1"

Also, SELECT PK - by PK I meant the primary key from the MailingList2 table. What is this field - you need to use it here instead of PK.

PluralSight Learning Library
 
Now its given a invaild sql statement error

DoCmd.RunSQL "; with cte as (select MailID, count(Address) over (partition by Address) as cntAddresses from MailingList2) update cte set SS = 'true' where cntAddresses > 1"
 
Are you using a microsoft SQL Server database, or are you using a Microsoft Access database?

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
If you're using SQL Server 2005 and up, can you first test this statement in SSMS and find if it's working (make it work). Only then let's worry of running it from the application.

PluralSight Learning Library
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top