Sorry if this is the wrong forum to place this one under, but it is an SQL query I have coded up in VBA for a search on a Access Database.. so sorry if this is the wrong forum to place this one under......
I have a SQL Query I have coded up in some Access VBA as follows:
strSQL = "SELECT * FROM tblLessons WHERE txtRelease LIKE " & Chr$(34) & likeWkStrmProj & Chr$(34) & _
" AND txtArea LIKE " & Chr$(34) & likeArea & Chr$(34) & _
" AND (txtWhySuccFail CONTAINS (" & Chr$(34) & likeFilterCriteria & Chr$(34) & ") > 0);"
Which when I put it in debug.print gives the following:
SELECT * FROM tblLessons WHERE txtRelease LIKE "%" AND txtArea LIKE "%" AND (txtWhySuccFail CONTAINS ("Lesson") > 0);
I am trying to find rows in table tblLessons where the txtRelease and txtArea are like the passed parameters (could be spaces and in this case it was and simply replaced by a simple "%") and the txtWhySuccFail CONTAINS some text (in this case it was "Lesson"). The txtWhySuccFail is looking in a memo type field and I just want to find an occurrence of the passed value (e.g. "Lesson") of it somewhere in that returned txtWhySuccFail row.....
Can you help?? Its sending me mad!!!
I think I need to do this as two queries, something like an inner query that does the Likes and then an Outer query that filters the returned set and looks for the CONTAINS values in txtWhySuccFail...... but honestly my brain is fried and I cant work it out......
Could anybody give me an example of what this should look like, or is there a better way of doing it? As it simply is not working.....
Thanks in advance....
I have a SQL Query I have coded up in some Access VBA as follows:
strSQL = "SELECT * FROM tblLessons WHERE txtRelease LIKE " & Chr$(34) & likeWkStrmProj & Chr$(34) & _
" AND txtArea LIKE " & Chr$(34) & likeArea & Chr$(34) & _
" AND (txtWhySuccFail CONTAINS (" & Chr$(34) & likeFilterCriteria & Chr$(34) & ") > 0);"
Which when I put it in debug.print gives the following:
SELECT * FROM tblLessons WHERE txtRelease LIKE "%" AND txtArea LIKE "%" AND (txtWhySuccFail CONTAINS ("Lesson") > 0);
I am trying to find rows in table tblLessons where the txtRelease and txtArea are like the passed parameters (could be spaces and in this case it was and simply replaced by a simple "%") and the txtWhySuccFail CONTAINS some text (in this case it was "Lesson"). The txtWhySuccFail is looking in a memo type field and I just want to find an occurrence of the passed value (e.g. "Lesson") of it somewhere in that returned txtWhySuccFail row.....
Can you help?? Its sending me mad!!!
I think I need to do this as two queries, something like an inner query that does the Likes and then an Outer query that filters the returned set and looks for the CONTAINS values in txtWhySuccFail...... but honestly my brain is fried and I cant work it out......
Could anybody give me an example of what this should look like, or is there a better way of doing it? As it simply is not working.....
Thanks in advance....