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

Error Using FindFirst Method 1

Status
Not open for further replies.

AllenRitch

Technical User
May 20, 2003
52
0
0
US
Can anyone tell me why I might be getting the error "Method or data member not found" when using the FindFirst Method in a procedure?

It works fine in another database I've built. And both databases are using the same Reference Libraries. Below is an excerpt of my code:

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(tblAgents, dbOpenDynaset)
strCriteria = "ACRID = '" & strACRID & "'"
rst.FindFirst strCriteria
 
Use explicit declaration of the recordset object:

[tt]dim rst as dao.recordset[/tt]

Also ensure you have a reference to Microsoft DAO 3.# Object library (in VBE - Tools | References)

Roy-Vidar
 
Thank you for your help; that definately did the trick. However, now I'm having a problem of a different sort. I'm now getting the error "Data type mismatch in criteria expression" for the following line:

rst.FindFirst strCriteria

The field ACRID in the tblAgents table is an AutoNumber which translates to a Long Integer. I've also declared strACRID as a Long so I'm not sure why I'm getting that particular error message. Any ideas?
 
For numerics, drop of the single quotes, they are only necessary for text fields.

[tt]strCriteria = "ACRID = " & strACRID [/tt]

(lngACRID? -> naming convention;-))

Roy-Vidar
 
Kudos...Kudos... Thanks for your help. It did the trick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top