Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / May 2006

Tip: Looking for answers? Try searching our database.

No Current Record   ????????? Help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Scott Burke - 24 May 2006 15:44 GMT
The Error:
"No Current Record"

The Code:
For Each fldTrail In rsTrail.Fields  <== the error
    If IsNull(fldTrail.Value) Then
        work1 = work1 & sizestr(fldTrail.Value, fldTrail.Size)
    Else
        If fldTrail.Type = dbDate Then
            work1 = work1 & sizedate(fldTrail.Value, DateType)
        Else
            work1 = work1 & sizestr(fldTrail.Value, fldTrail.Size)
        End If
    End If
Next fldTrail

Details:
This code gives the above error about 1 of 4 times it is run avg.
What condition will cause the error "No Current Record"?

I can run the CDSN clearance button right now and get an error.
I can run it a again and it will NOT give an error.  ?!?!?!?!?!!!!!!
I have to cut out the error.

Scott Burke
Allen Browne - 24 May 2006 16:42 GMT
Where does rsTrail come from?
Did you OpenRecordset?
Did you assign the RecordsetClone of a form?
Did you previously to a Seek or Find or Delete or AddNew?

Some cases where this can occur:
a) rsTrail has no records, there will be no current record.
Solution: test rsTrail.RecordCount

b) You performed a Find that did not result in a match.
There is therefore no current record.
Solution: test rsTrail.NoMatch

c) You have looped through the records past the end
(or looped backwards past the first record).
Solution: test rsTrail.EOF  (or for the 2nd case, rsTrail.BOF)

It is also possible to get the error after a Delete or AddNew.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> The Error:
> "No Current Record"
[quoted text clipped - 21 lines]
>
> Scott Burke
Scott Burke - 25 May 2006 14:23 GMT
Hi Allen,  Thank you for time.

I checked each of those options.  As it turns out it was a combination of b
and c.

I like to state that this program was written by someone else.  I would NOT
have written the code the way he/she did.  

AS it turns out, about 30 lines up the code he/she had a loop.  If the value
was not found you ended up in .EOF.
I did test for both .NoMatch and .RecordCount but because of the loop the
values were wrong.

Thanks again.
Scott Burke

> Where does rsTrail come from?
> Did you OpenRecordset?
[quoted text clipped - 40 lines]
> >
> > Scott Burke
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.