Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search MDB

Status
Not open for further replies.

guitardave78

Programmer
Sep 5, 2001
1,294
0
0
GB
Hi at the moment i am useing
strQuery = "SELECT * FROM Details where file_details LIKE '%" & findTxt & "%'"

(not sure why i am using % but nothing else works)
Is there a better way to search as this gives some pretty random search
if i type 1234 i get anything with 1, 2, 3, 4 etc

any ideas of how to refine?
 
The % is a wildcard character, which is why you are getting all the data. If you can provide some more detail as to what the data you are looking for contains, we can further assist you.

If you choose to battle wits with the witless be prepared to lose.

[cheers]
 
In MS Access, the wild card characters are * and ?
You should use
strQuery = "SELECT * FROM Details where file_details LIKE '*" & findTxt & "*'"

Searching for '1234' would then return only those records that contain that string in file_details.

The '%' is a wild card for MS SQL Server.
 
"%" is a wildcard for ADO and is also SQL-92 standard. "*" is used by DAO and Access.

The characters that you should use (or not use) are determined by which DB access method you are using.
 
Ok It is searching through a list of files and directories in an acess database.
I need to be able to use such search functions as *.exe *.exe and *.vbp

i got it giving me relevant results now using th %% but i need more control!!! (bwahhahahahah)
does that help?
 
If you are looking for "*.exe" in a field then use:
Code:
SELECT * FROM Details HERE File_Details LIKE '%.exe'
So if you amend your code to
Code:
... LIKE '%" & findTxt & "'"
it should do what you want.

Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
"A computer program does what you tell it to do, not what you want it to do." -- Greer's Third Law
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top