I have really searched the forum yet haven't found a total answer to my problem. I am updating a SQL table and the information is coming from another SQL table. The data being updated with could be null or might have an apostrophe or it might not.
I've literally read a mutlitude of posts yet none have dealt with all three together and when I try to pull what individual posts have said to do, in my update, I bomb . . .BIG TIME!
I'm hoping one of you good souls will help me.
Admittedly this is very crude but I've tried so many other ways, this is my latest attempt:
strSQL = "UPDATE [CFA-RPI Tracker] SET" _
& "[Preliminary Failure Analysis]=iif('" & my_Pre_Failure_Analysis & "' Not Like '*'*','" & my_Pre_Failure_Analysis & "','" & StrQuoteReplace(my_Pre_Failure_Analysis)) & "'," _
The StrQuoteReplace is a Function that reads like this:
Function StrQuoteReplace(strValue)
StrQuoteReplace = Replace(strValue, "'", "''")
End Function
The StrQuoteReplace Function worked great. . . so long as there was an astrophe in the data. Once it hit a string without one and/or was null or ="", then it bombed again.
Thanks for looking into this for me.
I've literally read a mutlitude of posts yet none have dealt with all three together and when I try to pull what individual posts have said to do, in my update, I bomb . . .BIG TIME!
I'm hoping one of you good souls will help me.
Admittedly this is very crude but I've tried so many other ways, this is my latest attempt:
strSQL = "UPDATE [CFA-RPI Tracker] SET" _
& "[Preliminary Failure Analysis]=iif('" & my_Pre_Failure_Analysis & "' Not Like '*'*','" & my_Pre_Failure_Analysis & "','" & StrQuoteReplace(my_Pre_Failure_Analysis)) & "'," _
The StrQuoteReplace is a Function that reads like this:
Function StrQuoteReplace(strValue)
StrQuoteReplace = Replace(strValue, "'", "''")
End Function
The StrQuoteReplace Function worked great. . . so long as there was an astrophe in the data. Once it hit a string without one and/or was null or ="", then it bombed again.
Thanks for looking into this for me.