Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to read data from a previous line on a subform

Status
Not open for further replies.

ViperD

IS-IT--Management
May 1, 2003
27
0
0
US
In Access 2000, I have a form with a subform that is in Datasheet layout. Is there a way to retrieve a value that is on the first or previous row of the subform? The code will be written in the subform.
 
Assuming you are on one row and need to obtain the value on a previous row, you may use the RecordsetClone property. This allows for navigation to another row without affecting the current row of the form. Sample Code snippet:

Public Sub RClone()
Dim rstClone As DAO.Recordset
Dim frm As Form

Set frm = Me

Set rstClone = frm.RecordsetClone

With rstClone
.MovePrevious
'Code for obtaining value here
End With

Set rstClone = nothing
Set frm = nothing
End Sub

Hope I understood your question correctly.
 
That is exactly what I was looking for. Thanks, I marked the post as helpful/expert post.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top