EOF

aziz rasul

Active member
Local time
Today, 14:55
Joined
Jun 26, 2000
Messages
1,934
I have a bit of code below which works. However instead of using

If IsError(RSsff.EOF = True) Then

I wanted to use

If RSsff.EOF = True Then

instead. However it would come with the error : - Run-time error '3021'. No current record. Does anyone know how I can get the EOF to work, or is it not possible.

[This message has been edited by aziz rasul (edited 12-21-2000).]

[This message has been edited by aziz rasul (edited 12-21-2000).]
 
IS this a recordset object?

If it is, you may not have set the source of the recordset properly.

The statement will work properly if there is a valid recordst object that is at end of file. Access cannot locate the End of file property unless the recordset is opened correctly.

Duane Barker
 
Here's the full code which was given by simongallop on a different post: -

Dim sfff As Single
Dim MySearch As String
Dim LastDigits As Variant
Dim StripAmount As Single
Dim NewSff As String
Dim NewSff1 As String
Dim Length As String
Dim StartSfff As String
Dim MyDB As Database
Dim RSsff As Recordset
Dim RSLO As Recordset

Sub NewNumbers()

Set MyDB = CurrentDb
Set RSsff = MyDB.OpenRecordset("tblSFF - Nynex", dbOpenDynaset)
Set RSLO = MyDB.OpenRecordset("tblLO Identifier's", dbOpenDynaset)
RSsff.MoveFirst
Do While Not RSsff.EOF
StartSfff = RSsff("LO Identifier")
sfff = Right(StartSfff, 3)
Length = Len(Right(StartSfff, 3))
MySearch = "[LO Identifier]=" & sfff
RSLO.FindFirst MySearch
LastDigits = RSLO("Number") + 1
StripAmount = Len(LastDigits)
Do
NewSff = sfff & Left(RSsff("New LO Reference"), (20 - StripAmount)) & LastDigits
NewSff1 = Left(NewSff, Length) & String(20 - Len(NewSff), "0") & Right(NewSff, StripAmount)
RSsff.Edit
RSsff("New LO Reference") = NewSff1
RSsff.Update
RSsff.MoveNext
LastDigits = LastDigits + 1
Loop Until RSsff.EOF = True Or RSsff("LO Identifier") <> StartSfff 'this is the line in question
RSLO.Edit
RSLO("Number") = LastDigits - 1
RSLO.Update
Loop
RSsff.Close
RSLO.Close
MyDB.Close

End Sub

[This message has been edited by aziz rasul (edited 12-22-2000).]

[This message has been edited by aziz rasul (edited 12-22-2000).]
 

Users who are viewing this thread

Back
Top Bottom