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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing against the next row

Status
Not open for further replies.

ooch1

MIS
Nov 4, 2003
190
GB
Hello,

Can someone please help me with a bit of code i'm trying to put together.

Besically, what i am trying to acheive is a loop through the recordset testing one row with any row below it.

However, i am at a loss as to how to represent the next row.

I've tried the following:
Code:
(M <> (with rs rs![meterpointref] rs.MoveNext end with))
where m = rs![meterpointref], but this is no good, does anyone no a bit of code that can help me out of this predicament??

OOch
 
testing one row with any row below it
You mean all the following rows ?
You may consider populating a dynamic array and then browse it.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I use the following to check on video reservations in one of my databases:

While Not rst4.EOF
If rst4.Fields.Item("DueDate") = "" Or IsNull(rst4.Fields.Item("DueDate")) Then
CopyHold = rst4.Fields.Item("CopyID")
Call ScheduleVideo
Exit Function
Else
rst4.MoveNext
End If
Wend

Hope that helps.
 
Thanks for the responses, but:

PHV - I WOuld not know how to set up a dynamic array and then browse it??

GrandKathy - Thanks for the suggestion, but as far as i can see you are testing the same item rather then against a different item within the same field.

Is there nothing similar to the offest function that you can use within excel, or alternatively a method of referencing a particular location similar to that of the excel Cells function???


OOch
 
In the VBA help file take a look at ReDim Preserve

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I would use a ADODB.Recordset.Clone, since a recordset is an array on steriods.
Code:
Dim conTest As ADODB.Connection
Dim rstTest As New ADODB.Recordset
Dim rstClone As ADODB.Recordset
Set conTest = CurrentProject.Connection
rstTest.Open [i]SourceName[/I], conTest, adOpenKeyset
Set rstClone = rstTest.Clone
While Not rstTest.EOF
  rstClone.AbsolutePosition = rstTest.AbsolutePosition
  While Not rstClone.EOF
    'Compare your field(s) here
    rstClone.MoveNext
  Wend
  rstTest.MoveNext
Wend
Hope this helps,
B.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top