Arthur Fuller
fuller.artful at gmail.com
Thu Apr 16 22:34:10 CDT 2009
On Thu, Apr 16, 2009 at 11:33 PM, Arthur Fuller <fuller.artful at gmail.com>wrote: > Wrap your strings in the following function: > > <vba> > Public Function q(str As String) As String > q = Chr(39) & str & Chr(39) > End Function > </vba> > > IOW, instead of refering a string head-on, which may contain quotes, use > q(FieldName) instead. Depending on circumstances, you may also need: > > <vba> > Public Function qq(str As String) As String > qq = Chr(34) & str & Chr(34) > End Function > </vba> > > Just wrap your column refs in a call to these functions instead of direct > references and you're guaranteed safety (from these boogers at least). > > e.g. > Debug.Print q("Patty O'Furniture") > --> 'Patty O'Furniture' > > hth, > Arthur > > >