problems with Recordset

  • Thread starter Thread starter wy
  • Start date Start date
W

wy

Hello,
I have a Recordset. when loop the Recordset I need to
handle differently for the first and the last record in
the Recordset. How can I do this?

Code should looks like this:

Public Function GetSourceData()
Dim RecSet As Recordset
Dim SQL As String

Set db = CurrentDb

SQL = "select * from BaseTable;"

Set RecSet = db.OpenRecordset(SQL)
With RecSet
Do While Not .EOF

If the record is the first record or last record of
the RecSet then

SQL query

Else

SQL query

End If

db.Execute (SQL query)
.MoveNext
Loop
End With
End Function
 
Back
Top