Searching an entry with VBA

Guillaume777

Registered User.
Local time
Today, 14:34
Joined
May 4, 2006
Messages
23
Hello, I'm trying to search an entry of a recordset with VBA

The entry can only be found by searching 3 field values. In my case the correct entry can only be found if the data in the field Date, No_Employe and No_Project all match the data of the entry I want.

Findnext doesn't work, it only access one field and I need three.
Seek doesn't work since it need to search a key, and neither Date, No_Employe or No_Project are keys.

How can I proceed ?

Should I use multiples Findnext ( how do I do that ? ) ?


EDIT :

Also please note that I'm searching for 400-500 entries in a row, so speed is an issue.
 
Last edited:
Firstly, you should not have a field named 'Date'. Call it rcdDate or something.

You can run a findnext like:

Dim rs as object
Set rs = me.recordset.clone

rs.FindNext "rcdDate = #" & myDate & "# AND No_Employee = " & myEmployee & " AND No_Project = " & myProject

if not rs.eof then

do whatever it is you do with the record here

end if
 

Users who are viewing this thread

Back
Top Bottom