Syntax error (1 Viewer)

Albilly

Registered User.
Local time
Today, 05:00
Joined
Nov 25, 2015
Messages
31
Hi, I am not sur eif this is the right section or not, I have a small syntax problem and after trying all possible syntax I cannot solve this one

I need to update a table with a replace function in it but I always get the synbtax error, this is the code I use right now:

strFind = "S:\__MTL\Corp\Tresor\Compliance reporting"
Set db1 = OpenDatabase(strDB)

db1.Execute "UPDATE PARAMETRE_CONFORMITE SET REPERTOIRE_DESTINATION = Replace(REPERTOIRE_DESTINATION, '" & strFind & "', '" & strSrc & "', , , vbBinaryCompare)"

the error is on the db1.execute
Where is my mstake here ???

Thanks
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 22:00
Joined
Jan 20, 2009
Messages
12,851
vbBinaryCompare is a VBA constant that is not available to the database engine.

Concatente it into the SQL command so that it becomes the value of the constant before being executed. Or directly use the zero that it stands for.
 

BlueIshDan

☠
Local time
Today, 09:00
Joined
May 15, 2014
Messages
1,122
You could always make a public function within a module that acts as an interface between VBA and the database engine... Idk what kind of flags that raises for anyone, or if it causes huge performance issues, but yeah...
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:00
Joined
May 7, 2009
Messages
19,230
db1.Execute "UPDATE PARAMETRE_CONFORMITE SET REPERTOIRE_DESTINATION = Replace(REPERTOIRE_DESTINATION, '" & strFind & "', '" & strSrc & "', , , 0)"
 

Users who are viewing this thread

Top Bottom