![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Alex, I also use the replace() function to eliminate quotations and apostrophes for SQL statement and it works great for me (I actually replace it double apostrophes, which becomes a single apostrophe). Why is the WHERE clause REPLACE(MYFIELD,"""",".")= """ ? Trying putting a breakpoint in VBA and then evaluate that SQL string in the Immediate window. Good Luck |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Try this: STRSQL = "SELECT * FROM TBLINMAIL WHERE Subject = '" & Replace(mySubject, """", ".") & "'" I don't think you need to put replace() around the field name part of the expression, only around the value part. Good Luck. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
I don't see why you need to put a replace around your table field name. It doesn't make sense. But if you wish, you can put it like this: strSQL = "SELECT * FROM TBLINMAIL WHERE replace(Subject,'""','.') = '" & Replace(mySubject, """", ".") & "'" *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#8
| |||
| |||
|
|
I am trying to create a recordset where some text fields are matching. The problem is that some of the text fields contain quotation marks. I have tried to create the sql string using replace eg. "SELECT * FROM MYTABLE WHERE REPLACE(MYFIELD,"""",".") = """ & REPLACE(MYTEXT,"""",".") & """" but this does not work. Trying to replace the quotation marks with some other character in this case the stop How can I embed the quotation marks in the sql string? Alex |
![]() |
| Thread Tools | |
| Display Modes | |
| |