How find a record in VBA recordset ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In an open recordset, I need to position on a record to update it. How do I do it
I need to find based on a criteria like 'columnname = value
I am using DAO not AD
To add records I am using .Addnew followed by .Updat

I looked in Access help but could not find anything
 
I need to find based on a criteria like 'columnname = value'

rsMyRecordset.FindFirst "ColumnName = ""Value"""
If rsMyRecordSet.NoMatch Then
MsgBox """Value"" was not found"

Else
rsMyRecordset.Edit
rsMyRecordset!ColumnName = "NewValue"
rsMyRecordset.Update

End If


or what about the faster, more maintainable, portable and friendlier to
your network admin and other users:-

UPDATE MyTable SET ColumnName = "NewValue"
WHERE ColumnName = "Value";


Hope that helps


Tim F
 
Back
Top