End of file??

sstasiak

Registered User.
Local time
Today, 07:45
Joined
Feb 8, 2007
Messages
97
I have a button, that when clicked, should go through every record in a table(tblEmployee), and set [PassChange] to Yes(-1).

I'm not sure how to specify to run through till it reaches the end of the file, but I think the rest should look something like this:

Dim RecIndex As Integer
RecIndex = 1
Do this until EOF(tblEmployee) is reached **don't know syntax for this part
SQL = "UPDATE tblEmployee SET [PassChange] = -1 WHERE [EmpID] = RecIndex **am I referencing RecIndex properly here?
CurrentDb.Execute SQL
RecIndex = RecIndex +1
Start loop again

Can anyone advise on the end of file part? Does the rest look good?
 
Why use a recordset and loop? That's horribly inefficient. Just run the update SQL without a WHERE clause.
 
Why use a recordset and loop? That's horribly inefficient. Just run the update SQL without a WHERE clause.

Good point.....thanks.
 

Users who are viewing this thread

Back
Top Bottom