|
-
Mar 22nd, 2000, 11:54 PM
#1
Thread Starter
Hyperactive Member
Help! I'm using the following to open a recordset and grab all the records that are a close match. Basically I have questions that aply for more than 1 subject that are exactly the same. I need to have the search criteria match using LIKE or similar. Any ideas?
Set rcdTemp2 = dbsData.OpenRecordset("select * from questions where QuestionName like '" & Mid(strTemp, 1, 6) & "'")
-
Mar 23rd, 2000, 12:17 AM
#2
Hyperactive Member
Hi.
Just an example. This is from sql tutorial site http://w3.one.net/~jhoffman/sqltut.htm:
Using LIKE
Look at the EmployeeStatisticsTable, and say you wanted to see all people whose last names started with "S"; try:
SELECT EMPLOYEEIDNO
FROM EMPLOYEEADDRESSTABLE
WHERE LASTNAME LIKE 'S%';
The percent sign (%) is used to represent any possible character (number, letter, or punctuation) or set of characters that might appear after the "S". To find those people with LastName's ending in "S", use '%S', or if you wanted the "S" in the middle of the word, try '%S%'. The '%' can be used for any characters in the same position relative to the given characters. NOT LIKE displays rows not fitting the given description. Other possiblities of using LIKE, or any of these discussed conditionals, are available, though it depends on what DBMS you are using; as usual, consult a manual or your system manager or administrator for the available features on your system, or just to make sure that what you are trying to do is available and allowed. This disclaimer holds for the features of SQL that will be discussed below. This section is just to give you an idea of the possibilities of queries that can be written in SQL.
If you are using Access, then instead of % you should use *.
Larisa
-
Mar 23rd, 2000, 12:23 AM
#3
Thread Starter
Hyperactive Member
Cool, I'll try that. Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|