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

Looping through continuous form records 2

Status
Not open for further replies.

Moss100

Technical User
Aug 10, 2004
585
GB
Hello I am trying to learn how to loop through records on a continuous form.

I was hoping that the code below would cycle through each record where email_id was <=3 and enter the word 'set' into the 'test_data' field.

Could someone show me where I am going wrong here.

Thank you

Mark

Code:
Private Sub Command4_Click()

DoCmd.GoToRecord , , acFirst

Do While EMail_ID <= 3

Me.test_data = "set"

DoCmd.GoToRecord , , acNext

Exit Do

Loop


End Sub



 
What about this ?
Code:
Private Sub Command4_Click()
With Me.Recordset
  .MoveFirst
  Do While Not .EOF
    If !EMail_ID <= 3 Then
      !test_data = "set"
    End If
    .MoveNext
  Loop
End With
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
You have [tt]Exit Do[/tt] inside your loop so your loop is done after first record.

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top