dempster, many thanks for that, it works a treat apart from
the cfquery does not like executing the dyanmic code, even if I
build the whole sql text in a variable before.
for example the following code executes fine
<cfquery name="#search#" datasource="#datasource#"
cachedwithin="#CreateTimeSpan(0,1,0,0)#">
SELECT * FROM #tablename# where mailingname is not null and
mailingname like '%shepton%'</cfquery>
but the following does not, I get an invalid column"shepton"
error, but the structure of the 2 queries is exactly the same!!
<cfset sqltext = "and mailingname like '%shepton%'">
<cfquery name="#search#" datasource="#datasource#"
cachedwithin="#CreateTimeSpan(0,1,0,0)#">
SELECT * FROM #tablename# where mailingname is not null
#sqltext#</cfquery>
many thanks