B
Bob Barnes
I can trap entry of single-quote and double-quote in entry from a Form, but
that can't be trapped if entered directly into a Table (unless Access
Security is set)...correct?? The Client doesn't want Access Security set.
Single-quote is for ft and double-quote is for inches (in).
I'm running code like..
Note..
Q = "SELECT Account, Make, Model, Sum([Total Inventory]) AS TotInv" _
& " FROM Orders WHERE Account = """ & P & """" _
& " And Make = """ & T & """ And Model = " & Chr(39) & U & Chr(39) & "" _
& " GROUP BY Account , Make, Model;"
where the Chr(39)..s above trap for a double-quote..
Someone in this Newsgroup was kind enough to display..
Public Function SafeString(ByVal Txt As String) As String
SafeString = Replace(Replace(Txt, Chr(39), Chr(39) & Chr(39)), Chr(34),
Chr(34) & Chr(34))
End Function
...but it's not trapping single-quote when I modify the code like..resulting
in an error.
W (a string)...
W = SafeString(U)
.....
Model = """ & W & """....
Ideas?
TIA - Bob
that can't be trapped if entered directly into a Table (unless Access
Security is set)...correct?? The Client doesn't want Access Security set.
Single-quote is for ft and double-quote is for inches (in).
I'm running code like..
Note..
Q = "SELECT Account, Make, Model, Sum([Total Inventory]) AS TotInv" _
& " FROM Orders WHERE Account = """ & P & """" _
& " And Make = """ & T & """ And Model = " & Chr(39) & U & Chr(39) & "" _
& " GROUP BY Account , Make, Model;"
where the Chr(39)..s above trap for a double-quote..
Someone in this Newsgroup was kind enough to display..
Public Function SafeString(ByVal Txt As String) As String
SafeString = Replace(Replace(Txt, Chr(39), Chr(39) & Chr(39)), Chr(34),
Chr(34) & Chr(34))
End Function
...but it's not trapping single-quote when I modify the code like..resulting
in an error.
W (a string)...
W = SafeString(U)
.....
Model = """ & W & """....
Ideas?
TIA - Bob