Your code does not open recordset.
Set rs = CurrentDb.OpenRecordset("SELECT * FROM [some table/query name here] WHERE some criteria here;")
There are many books with code examples. Here is one: Access™ 2007 Programming by Example with VBA, XML, and ASP by Julitta Korol, Wordware Publishing, Inc. I expect there is a later edition. Have to learn VBA language and syntax, apply logic to construct algorithms suitable to the situation.
Consider:
Code:
Dim rs As DAO.Recordset
Dim intI As Integer
Set rs = CurrentDb.OpenRecordset("SELECT InvoiceNo FROM Invoices WHERE InvoiceNo = 0;")
intI = DMax("InvoiceNo", "Invoices") + 1
While Not rs.EOF
rs.Edit
rs!InvoiceNo = intI
rs.Update
rs.MoveNext
intI = intI + 1
Wend
rs.Close
Set rs = Nothing