Hi all
Having trouble with processing the last record in a recordset.
I have a nested loop. The code is working great - until the last row in the recordset. As far I can tell, what is happening, is that I have 'MoveNext', which eventually gets to the last row in the recordset, and then loops, evaluates the DoUntil EOF - say's "yep, I'm at the recordset end of file", so quits out of the loop, before processing the final row. Any ideas on fixing this? Thanks
=========================
Dim db As Database
Dim rs As DAO.Recordset
Dim tempFixtureID As Integer
Dim AllUmpires As String
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM qryContactUmpires Where FixtureDate = #10/06/2018#;", dbOpenDynaset)
AllUmpires = ""
Do Until rs.EOF
tempFixtureID = rs.Fields("FixtureID")
Do While tempFixtureID = rs.Fields("FixtureID")
AllUmpires = AllUmpires & rs.Fields("UmpireName") & "; "
rs.MoveNext
Loop
AllUmpires = ""
Loop
Having trouble with processing the last record in a recordset.
I have a nested loop. The code is working great - until the last row in the recordset. As far I can tell, what is happening, is that I have 'MoveNext', which eventually gets to the last row in the recordset, and then loops, evaluates the DoUntil EOF - say's "yep, I'm at the recordset end of file", so quits out of the loop, before processing the final row. Any ideas on fixing this? Thanks
=========================
Dim db As Database
Dim rs As DAO.Recordset
Dim tempFixtureID As Integer
Dim AllUmpires As String
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM qryContactUmpires Where FixtureDate = #10/06/2018#;", dbOpenDynaset)
AllUmpires = ""
Do Until rs.EOF
tempFixtureID = rs.Fields("FixtureID")
Do While tempFixtureID = rs.Fields("FixtureID")
AllUmpires = AllUmpires & rs.Fields("UmpireName") & "; "
rs.MoveNext
Loop
AllUmpires = ""
Loop