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

Record Function

Status
Not open for further replies.

Albano

Instructor
Dec 11, 2000
221
PT
Help enyone,

I need a function to search a table for a expecific record, given in criteria and return is number position on the table.

ex: serch for record on fild Last=true.

Tanks,
Albano
 
This example assumes that Last is a Yes/No Field

Dim db As DAO.DATABASE, rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("TableNameGoesHere", dbOpenDynaset)
With rst
.FindFirst "[Last] = " & True
If Not .NoMatch Then
MsgBox "Record Was Found And Position is " _
& rst.AbsolutePosition + 1
End If
End With



PaulF
 
Thanks PaulF I will tray, but if you know a function that don´t use recordsets it will usefull.

Albano
 
Albano, try the DLookup function
dim location as Long
location = DLookup("your position","your table","your criteria")
John A. Gilman
gms@uslink.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top