Quote:
> > > I'd like to run an SQL query where the pseudocode is:
> > > select * from <table> where <textfield> is a text field
> > > contained within S where S is a predefined string variable.
> > > Is that possible ?
> > Dim SQL As String: SQL = "select distinctrow [" & TableName & "].*"
> > SQL = SQL & " from [" & TableName & "] where Instr('" & S & "',"
> > SQL = SQL & " [" & TableName & "].[" & FieldName & "]) > 0;"
> > This query is going to require a linear scan of the entire table.
[chomp]
Quote:
> How about...
> Select * from tablename where fieldname LIKE '%mysubstring%'
> Different SQLs may use something besides "%" for multilength wildcard.
You may be right. I interpreted the question as, find all records
where the string S contains the value of text field X. Your
query, on the other hand, will find all records where the value
of X contains S. My interpretation fits this query:
Select * from tablename where 'mysubstring' LIKE '%' + fieldname + '%'
I decided to use InStr in my original query because of the
possibility of S containing characters special to the LIKE
operator, but perhaps that made things less clear.
[snip]
--
WARNING: I cannot be held responsible for the above They're coming to
because my cats have apparently learned to type. take me away, ha ha!