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

Moving through records

Status
Not open for further replies.

Tronsliver

Technical User
Sep 19, 2000
120
US
I want to build a procedure that searches through a query looking for a record that meets certain crteria and then assign the result to a text box on a form. The query has four fields: Paycode, AuthStrength, Required and Turnover. The Index field is Paycode. During the search if paycode = 610 then assign AuthStrength to "Text" control on a form. There are 50 records in the query. I can't find enough info in the help file to assist me. I'm only interested in the "VB code" solution for this.

Thank You
 
Code:
Dim db As Database
Dim qry As QueryDef
Dim rst As Recordset
Set db = CurrentDb
Set qry = db.CreateQueryDef("", "Select * FROM tableName Where Paycode = 610")
Set rst = qry.OpenRecordset()
if rst.eof = false then
   me.text = rst!AuthStrength
end if
set rst = nothing

This should do it for you. You will need to change a few things to suit your needs, but this is the basic way to do it. If you need anything else let me know. The hardest questions always have the easiest answers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top