problems with Recordset

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
 
V

Van T. Dinh

Check Access VB Help on the AbsolutePosition Property of the Recordset
Object.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top