Loop through a Recordset

Precisio

New member
Local time
Today, 15:17
Joined
Jul 24, 2009
Messages
3
Any help is much appreciated here, I'm stuck. I'm trying to have a form test each record in a table for 3 conditions and Disable a button if true:

If CommitedTask=true AND TaskFinishDate < Date AND TaskStatus < 100%

I've created a recordset that has the Table of these three fields, but I need to loop though it and test these conditions. It seems to me like a For Each Loop would be the method of choice, but I can't seem to figure out how to make it work.

Any suggestions?

Thanks
Nick
 
Here's an example:

Private sub Blah ()

Dim dbs As DAO.Database

Dim rstBlah As DAO.Recordset

Set dbs = CurrentDb()

Set rstBlah = dbs.OpenRecordset("Select * from tblblah", dbOpenSnapshot, dbSeeChanges)

Do While Not rstBlah.EOF

If rstBlah!blabbity = “snarf” then
Yadda yadda
End if

rstBlah.MoveNext

Loop

rstBlah.Close

Set rstBlah = Nothing

Set dbs = Nothing
exit Sub

End Sub
 

Users who are viewing this thread

Back
Top Bottom