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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find ...

Status
Not open for further replies.

KryptoS

Programmer
Feb 7, 2001
240
BE
I have to find something

e.g.

oRS2.MoveFirst
oRS2.Find "field1= '" & left(box2,9) & "'"
oRS2.Find "field2= '" & mid(box2,10,14)) & "'"
oRS2.Find "field3= '" & mid(box2,14,17)) & "'"

box2 is a input field can I also do something like this?

oRS2.MoveFirst
oRS2.Find "field1||field2||field3 = '" & box2 &"'"

who can help me?
 
dim findString
findString = "field1='" & box2 &"' OR field2='" & box2 &"' OR field3='" & box2 &"'

oRS2.find = findString

will move your cursor to the first record that matches that criteria --

:)
 
that's not what I meant:

you see, in the field box2 I got a date like this:
"2000-2001: 1/9/2000 - 5/6/2001"
now:
2000-2001 is field1 in my recordset
1/9/2000 is field2 in my recordset
5/6/2001 is field3 in my recordset

how can I find the record that matches with my box2-field?
 
Ahh --

Then depending on whether or not you already have your recordset created (in which case, you could use .filter), or you haven't created it yet (in which case you'd wanna use a WHERE clause in your SQL Statement), you can do it either of the two ways --

"SELECT top 1 FROM tableName WHERE field1='" & left(box2,9) & "' AND field2='" & mid(box2,10,14)) & "' AND field3='" & mid(box2,14,17)) & "'

would return a recordset with only those records

--or--

rRS2.filter "field1='" & left(box2,9) & "' AND field2='" & mid(box2,10,14)) & "' AND field3='" & mid(box2,14,17)) & "'

would filter an existing recordset down to records that match that criteria


assuming those mid and left functions give you the correct parts of the string (and I'm sure they do), then I don't think it's going to get much simpler than that.

good luck! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top