Help with Recordsets
I have the following code:
Public Sub DoSomething()
On Error GoTo ErrHandler
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim i As Integer
'Define using current database, and open table
Set db = CurrentDb
Set rst = db.OpenRecordset("yourtablename", dbOpenSnapshot)
'Make sure table has records, and set to first record.
If .RecordCount > 0 Then
'Loop through each record
For i = 1 To rst.RecordCount ' 1 to Count of records
If .Field5 = "xxx" Then
'Move to the next record
'Clear variables used from memory
Set rst = Nothing
Set db = Nothing
i = 0
'Always include error trapping. this is the bare minimum...
MsgBox Err.Number & ": " & Err.Description
i need to find a way to do the following:
1. Set two fields of the table as variables
2. copy rows of the table based on the variables
3. delete the rows after they are copied until the table is empty.
I am new here so am trying learn
Thank you in advance.