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

need help finding a record using vb .Find

Status
Not open for further replies.

marnold37341

Programmer
Mar 4, 2002
7
US
I have an Access 2000 table that is ordered by RecapEmpID and RecapDate. I have also set up a multi-field index, RecapIndex, using the above two fields. I'm getting to the table using ADODB, and have "accessed" this table, as well as others, successfully. However, all my record management has been .MoveFirst, .MoveNext, etc.

Searching thru this 10,000 + record set is not efficiently accomplished using .MoveFirst, .MoveNext - consequently I want to use .Find

Here's my .Find line

.Find "RecapEmpID = ThisRecordEmpID"

When running my VB Code, I get the following run-time error:

Run-time error '3001':

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

Both the field in the table (RecapEmpID) and my variable (ThisRecordEmpID) are defined as Long Integer. There are 35 records in the table with the EmpID I am supplying.

Any help on what I'm doing wrong would be greatly appreciated.

Mickey Arnold
marnold37341@yahoo.com
 
change

.Find "RecapEmpID = ThisRecordEmpID"

to
' if RecapEmpID is number
.Find "RecapEmpID = " & ThisRecordEmpID

' if RecapEmpID is text
.Find "RecapEmpID = '" & ThisRecordEmpID & "'" John Ruff - The Eternal Optimist :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top