Problems With A Simple While Not EOF Statement

crhodus

Registered User.
Local time
Today, 02:39
Joined
Mar 16, 2001
Messages
257
Can someone help me with the coding of this. I'm not very familiar with VBA. What I want to do is go through all the records in the table COMPANY_TABLE. If the field YN_Holder is set to true, then I want the YN_Holder set back to false. Here is what I want it to do down below. I just don't know how to code it. I'm assigning this code to my button's On Click.


While Not EOF COMPANY_TABLE Do
Begin
If COMPANY_TABLE!YN_HOLDER = TRUE
COMPANY_TABLE!YN_HOLDER = False
End If
Wend


If someone could help me, I'd greatly appreciate it!
 
Hi, it sounds as if you're just going to end up with a table of false's on YN_Holder ( they either already are, or they will be). Why not just use an update query and do the whole lot?

HTH

Drew
 
Thanks! That worked great, totally forgot about doing that. I'm making things much more complicated than they should be.

Anyway, since I've been working on this using VB, could someone tell me if the code that I have come up with so far is correct? I still have some errors that I'm trying to work out.

Private Sub cmdExportIndiv_Click()
Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset("Company_T", dbOpenDynaset)

If Not rs.EOF Then rs.MoveFirst
Do While Not rs.EOF
If rs!INDIVIDUAL = TRUE
rs!INDIVIDUAL = False
End If
rs.MoveNext
Loop
 

Users who are viewing this thread

Back
Top Bottom