record set to change field (1 Viewer)

bonekrusher

Registered User.
Local time
Yesterday, 21:05
Joined
Nov 19, 2005
Messages
266
Hi all, I am trying to update a field based on another field through a record set. In this code I want to update SYS if Element_label is like 3 (the field has values 3.1, 3.3.1 etc...). Am I going about this the right way?

Code:
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("description")
While Not rst.EOF
    With rst
    If rst![Element_Label] Like 3 Then
    rst![sys] = 3
   
    Else: End If
      End With
rst.MoveNext

Wend
 

ejstefl

Registered User.
Local time
Today, 05:05
Joined
Jan 28, 2002
Messages
378
Are you getting any error messages when you run this? Another way to do it might be to use an update query as well.
 

bonekrusher

Registered User.
Local time
Yesterday, 21:05
Joined
Nov 19, 2005
Messages
266
Thanks, thats what I needed to do. It was so easy it slipped past me.

Thanks
 

Users who are viewing this thread

Top Bottom