If the problem is having single quotes in SQL's string literal:
strSQL = strSQL & "WHERE somefield=[tt]'"[/tt] & Replace(somevar, [tt]"'", "''"[/tt]) & [tt]"'"[/tt]
Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886