G
Guest
I have the following SQL statement that is supposed to replace a path in a
table. I have been trying to get it for some time now and thought it about
time to post it. It appears that the vbTextCompare portion of the strPos is
causing the problem. (Maybe something else also, I don' t know) Thank you for
your help.
Dim strSQLUpdateIt As String
Dim strStarting As String, strOldComa As String, strNewComa As
String
Dim strPos As String, strComa As String, strWhere As String
'get length of old string
Dim intLength As Integer
intLength = Len(strOld)
strComa = ","
strStarting = "Update tblPlants Set PicPath = Replace(PicPath,"
strOldComa = "'" & strOld & "'" & strComa
strNewComa = "'" & strNew & "'" & strComa
strPos = "1," & intLength & strComa & vbTextCompare & ")"
strWhere = "WHERE PicPath Is Not Null"
strSQLUpdateIt = strStarting & strOldComa & strNewComa & strPos
& strWhere
DoCmd.RunSQL strSQLUpdateIt
This is the text I get when I view the SQL statment in the intermediate
window:
Update tblPlants Set PicPath =
Replace(PicPath,'R:\Graphics\JPEG's\','E:\Graphics\JPEG's\',1,19,1)WHERE
PicPath Is Not Null
table. I have been trying to get it for some time now and thought it about
time to post it. It appears that the vbTextCompare portion of the strPos is
causing the problem. (Maybe something else also, I don' t know) Thank you for
your help.
Dim strSQLUpdateIt As String
Dim strStarting As String, strOldComa As String, strNewComa As
String
Dim strPos As String, strComa As String, strWhere As String
'get length of old string
Dim intLength As Integer
intLength = Len(strOld)
strComa = ","
strStarting = "Update tblPlants Set PicPath = Replace(PicPath,"
strOldComa = "'" & strOld & "'" & strComa
strNewComa = "'" & strNew & "'" & strComa
strPos = "1," & intLength & strComa & vbTextCompare & ")"
strWhere = "WHERE PicPath Is Not Null"
strSQLUpdateIt = strStarting & strOldComa & strNewComa & strPos
& strWhere
DoCmd.RunSQL strSQLUpdateIt
This is the text I get when I view the SQL statment in the intermediate
window:
Update tblPlants Set PicPath =
Replace(PicPath,'R:\Graphics\JPEG's\','E:\Graphics\JPEG's\',1,19,1)WHERE
PicPath Is Not Null