What is wrong with this Query?

R

rebelscum0000

Dear All

Can someone please let me know what is wrong with this query? When I
paste from the SQL View to my code (Module) all is in red

Thanks in advance

Regards,
Antonio Macias

sQL9 = _
"UPDATE Directories_C_Tbl SET Directories_C_Tbl.MyDirectories
= "DIR", Directories_C_Tbl.MyDirectoryPath = "C:\Dups V.1.0" " & _
"WHERE (((Directories_C_Tbl.MyDirectories) Is Null) AND
((Directories_C_Tbl.MyDirectoryPath)="C:\Dups V.1.0\"));


CurrentDb.Execute sQL9, dbFailOnError
 
D

Dirk Goldgar

In
rebelscum0000 said:
Dear All

Can someone please let me know what is wrong with this query? When I
paste from the SQL View to my code (Module) all is in red

Thanks in advance

Regards,
Antonio Macias

sQL9 = _
"UPDATE Directories_C_Tbl SET Directories_C_Tbl.MyDirectories
= "DIR", Directories_C_Tbl.MyDirectoryPath = "C:\Dups V.1.0" " & _
"WHERE (((Directories_C_Tbl.MyDirectories) Is Null) AND
((Directories_C_Tbl.MyDirectoryPath)="C:\Dups V.1.0\"));


CurrentDb.Execute sQL9, dbFailOnError

You've got quotes in your quote-delimited SQL string (and also you don't
have a closing quote for the SQL literal. You need to either double up
the embedded quotes, or use single-quotes instead of double-quotes
within the string:

sQL9 = _
"UPDATE Directories_C_Tbl SET " & _
"MyDirectories = 'DIR', " & _
"MyDirectoryPath = 'C:\Dups V.1.0' " & _
"WHERE ((MyDirectories Is Null) " & _
"AND (MyDirectoryPath='C:\Dups V.1.0\'));"
 
R

rebelscum0000

In











You've got quotes in your quote-delimited SQL string (and also you don't
have a closing quote for the SQL literal. You need to either double up
the embedded quotes, or use single-quotes instead of double-quotes
within the string:

sQL9 = _
"UPDATE Directories_C_Tbl SET " & _
"MyDirectories = 'DIR', " & _
"MyDirectoryPath = 'C:\Dups V.1.0' " & _
"WHERE ((MyDirectories Is Null) " & _
"AND (MyDirectoryPath='C:\Dups V.1.0\'));"

--
Dirk Goldgar, MS Access MVPwww.datagnostics.com

(please reply to the newsgroup)- Hide quoted text -

- Show quoted text -

Thank you

I changed Is Null For ="" and it works

sQL9 = _
"UPDATE Directories_C_Tbl SET " & _
"MyDirectories = 'DIR', " & _
"MyDirectoryPath = 'C:\Dups V.1.0' " & _
"WHERE ((MyDirectories =''" & "" & "' ) " & _
"AND (MyDirectoryPath='C:\Dups V.1.0\'));"



CurrentDb.Execute sQL9, dbFailOnError "

Regards
Antonio Macias
 

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