"No current record" error now affecting all versions of my database (1 Viewer)

OuterApply

New member
Local time
Yesterday, 17:05
Joined
Mar 10, 2022
Messages
15
This problem has nothing to do with Windows or versions. It's a design problem in your database.

Place breakpoints in all Form event-related code (startup, load, current, etc) and step through them at runtime line by line until you figure out at what point you have coded something that does not make sense because there is no current record.

This isn't one that can be just guessed.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 17:05
Joined
Aug 30, 2003
Messages
35,743
Word on the streets is that Office v2204 has caused this issue. Try on a computer that hasn't been updated to that, or revert one and try it.
 

Auntiejack56

Registered User.
Local time
Today, 10:05
Joined
Aug 7, 2017
Messages
168
sorry if I'm missing some relevant info from above, but you note you are clicking button on a quote record in a subform. If you click first on a field in the quote record, and then subsequently click the open button, is the behaviour different? I'm thinking about where the focus is at the time the button is clicked, and whether Access is able to identify the correct record at the time of the open command.
It should work as you've coded it, but there might be a timing issue that is complicating things.
 

Isaac

Lifelong Learner
Local time
Yesterday, 17:05
Joined
Mar 14, 2017
Messages
6,678
sorry if I'm missing some relevant info from above, but you note you are clicking button on a quote record in a subform. If you click first on a field in the quote record, and then subsequently click the open button, is the behaviour different? I'm thinking about where the focus is at the time the button is clicked, and whether Access is able to identify the correct record at the time of the open command.
It should work as you've coded it, but there might be a timing issue that is complicating things.
I've gotten this error a million times before, and it's always been my fault in the code. Windows updates are the usual bogeyman that we blame until we find the culprit of our own making, just sayin.. ;)
 

GinaWhipp

AWF VIP
Local time
Yesterday, 20:05
Joined
Jun 21, 2011
Messages
5,881
I've gotten this error a million times before, and it's always been my fault in the code. Windows updates are the usual bogeyman that we blame until we find the culprit of our own making, just sayin.. ;)
With the reports now coming in, nope not code and certainly not code that has not only been working for years and works fine in earlier versions or files that have not yet been updated.
 

zebrafoot

Member
Local time
Today, 01:05
Joined
May 15, 2020
Messages
51
More confusing behaviour from the database now:

This morning I got into work and fired it up to discuss the issue with my boss. In my Contacts form I have a subform with a button alongside each data entry with the following code underlying it:

DoCmd.OpenForm "frmOpportunity", , , "[OpportunityID]=" & Me![OpportunityID]
DoCmd.Close acForm, "frmContacts", acSavePrompt

I clicked it and got the error. Last night I think I managed to establish that it's the closing of forms that's connected to the issue. I then commented out the second line of the above code, so that the button ONLY opens the form frmOpportunity and doesn't close the form frmContacts.
There was then no error.

I then REINSTATED the second line of code and the error does not appear now.

BUT..... if I step to a different contact using the navigation buttons I put in, the error DOES appear. However this only happens the FIRST time I click to visit frmOpportunity. If I return to the contact, then go back to the opportunity, the second visit does not trigger the error.

However, all this behaviour seems to be somewhat unpredictable and it has definitely only just started. As I think I've mentioned in the thread, I am also getting errors occasionally when viewing the form in Design View.

I have no problem believing that there are coding or design flaws in my database, but I'm absolutely certain I've never seen these errors before so if there is an underlying issue with the way I've done things it has only become noticeable because of something else that has changed. I'm particularly confused by getting an error when swapping to Design View. How can that cause an error if I'm not saving data/opening data etc?

Pete
 

zebrafoot

Member
Local time
Today, 01:05
Joined
May 15, 2020
Messages
51
Thank you, Minty. I think we have an older PC that hasn't yet been updated. I'll check with that and/or roll back my version of Windows, if that is possible.
 
Last edited:

SeanAC86

New member
Local time
Today, 01:05
Joined
May 11, 2022
Messages
3
Since yesterday this has been happening to me on all my forms. It's nothing to do with my coding.

Note these messages ("No Current Record", "Invalid Operation", "Search Key Could Not Be Found") occur only on Single Forms containing a Subform. It does not appear to affect Continuous Forms or Single Forms without a Subform.

Edit: Seems to be if recordset (.findfirst / .movelast etc) is used on the main form, either by opening/loading with or subsequent searching.
Opening the form with no code and closing the form otherwise does not pop the error.

This problem has nothing to do with Windows or versions. It's a design problem in your database.

Place breakpoints in all Form event-related code (startup, load, current, etc) and step through them at runtime line by line until you figure out at what point you have coded something that does not make sense because there is no current record.

This isn't one that can be just guessed.
 
Last edited:

Auntiejack56

Registered User.
Local time
Today, 10:05
Joined
Aug 7, 2017
Messages
168
If there is a corruption, one way to find it is to create a new blank database and import all the tables from the old one, then the queries, then the tables etc. Sometimes the corrupted object can be identified because it won't import. Other times, the import fixes the problem.
 

SeanAC86

New member
Local time
Today, 01:05
Joined
May 11, 2022
Messages
3
Done all that, doesn't work.

It's a bug with new version of Access. Doesn't happen on previous version.

Just created a new database to illustrate - when Form2 (Single Form with a Subform) opens with a Recordset.Movelast on load, the error will pop up when Form2 is closed.

Edit: Seems the presence of a Subform is irrelevant
 

Attachments

  • Database1.accdb
    696 KB · Views: 32
Last edited:

Auntiejack56

Registered User.
Local time
Today, 10:05
Joined
Aug 7, 2017
Messages
168
Well, there you go, I've learnt something new, I never thought
Code:
Me.Recordset.MoveLast
was a thing.
In the dark ages, I learned that you shouldn't (in fact, couldn't) use the Me.Recordset object to navigate a form, you had to use something like
Code:
    Dim rs As DAO.Recordset
    Set rs = Me.RecordsetClone
    rs.MoveLast
    Me.Bookmark = rs.Bookmark
which, incidentally, works fine on the form you posted. I guess some new Access version has mucked up your movelast, who knows - certainly not this little black jack.
 

NauticalGent

CopyPaster of the First Order
Local time
Yesterday, 20:05
Joined
Apr 27, 2015
Messages
5,135
I found this issue on my daily rounds and was going to start a new thread but decided to check first, glad I did. And the hits just keep on going...
 

SeanAC86

New member
Local time
Today, 01:05
Joined
May 11, 2022
Messages
3
Well, there you go, I've learnt something new, I never thought
Code:
Me.Recordset.MoveLast
was a thing.
In the dark ages, I learned that you shouldn't (in fact, couldn't) use the Me.Recordset object to navigate a form, you had to use something like
Code:
    Dim rs As DAO.Recordset
    Set rs = Me.RecordsetClone
    rs.MoveLast
    Me.Bookmark = rs.Bookmark
which, incidentally, works fine on the form you posted. I guess some new Access version has mucked up your movelast, who knows - certainly not this little black jack.
This works great! Going to alter my code to this as a workaround.

Many thanks
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:05
Joined
Sep 21, 2011
Messages
10,853
Another thread says if you use Update Now option then the fix is installed?
 

isladogs

CID VIP
Local time
Today, 01:05
Joined
Jan 14, 2017
Messages
16,389
Interesting. I've had 365 v2204 build 15128.20178 for a while on several workstations and still haven't experienced this bug. Lucky me!
I tried the example app from post #32 and it works for me without error.
 

NauticalGent

CopyPaster of the First Order
Local time
Yesterday, 20:05
Joined
Apr 27, 2015
Messages
5,135
Interesting. I've had 365 v2204 build 15128.20178 for a while on several workstations and still haven't experienced this bug. Lucky me!
I tried the example app from post #32 and it works for me without error.
Your reputation precedes you. Nobody wants to mess with "The Refugee From Across the Sea"...
 

isladogs

CID VIP
Local time
Today, 01:05
Joined
Jan 14, 2017
Messages
16,389
Just updated 365 again to 15128.20224. All still OK it seems 👍
Normally any Access monthly update bug that comes along seems to affect me immediately!
 

keviny04

New member
Local time
Yesterday, 17:05
Joined
Mar 28, 2018
Messages
5
The problem seems to have been fixed. I was also hit by this, and had to tweak my code that involved Recordset, like the posters did above. But note that this had nothing to do with Recordset nor our coding skills. All the errors in this little mishap had nothing to do with anything. It was just a silly bug that seemed to have produced random inconsequential symptoms. If this had happened only in a full moon at midnight, we would've been tempted to think that we shouldn't use Access in a full moon at midnight.

P.S. The really annoying thing was that those errors were untrappable. They just popped up after I had closed a form and all code execution had ended. These were completely phantom errors. I even got an "automation" error that actually referenced a variable's name in my code.
 

Users who are viewing this thread

Top Bottom