|
-
Sep 8th, 2000, 02:52 PM
#1
Thread Starter
Member
I'm trying to search a table with the following data format:
#.#.#.#/#, #.#.#.#/#, #.#.#.#/#, #.#.#.#/#
I want to check to see if a string (#.#.#.#/#) exists anywhere in the table. I've got a .FindFirst query (posted below) that won't return a match. Maybe my approach is wrong.
Set db = CurrentDb
Set rs = db.OpenRecordset("MainData", dbOpenDynaset)
strSrch = "IP like '" & currentEntry & "'"
With rs
.MoveFirst
.FindFirst strSrch
If .NoMatch Then
MsgBox "NOMATCH"
Else
MsgBox "MATCH!"
End If
End With
-
Sep 8th, 2000, 04:45 PM
#2
Hyperactive Member
to the best of my knowledge (someone correct me if I am wrong), you can only use the LIKE operator with strings, and you have to include the * or whatever wildcard character your SQL uses. For Jet, it would be LIKE '" & currentEntry & "*'
it doesn't appear that your fields are strings, though. What are they, dates? numbers?
-
Sep 8th, 2000, 05:04 PM
#3
Thread Starter
Member
partial match query
Actually, they are all strings. I have to have them that way to manipulate them later. I have to search through a cell containing this data:
12.3.54.63/12, 43.23.34.54/9, 234.45.23.5/14, 12.12.45.6/24
and have it tell me if 43.23.34.54/9 is there or not.
For some reason, the .FindFirst doesn't like the wildcards. If there another way I should do this? Or is my code off?
-
Sep 8th, 2000, 05:14 PM
#4
Thread Starter
Member
partial query success
I got it! Thanks. I tried a slight modification of what I had been doing with the wildcards and changed wildcards to the Jet version (Had been using SQL.... darrr...)
Right!
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
|