0
votes

We have an Access (2013, 32 bit) front-end database with a switchboard form with buttons to open other forms. Those other forms have buttons that (when pushed) close themselves and return to the switchboard form.

Recently, when you have a particular (non-switchboard) form open, and you click the button to return to the switchboard, you sometimes get a messagebox that simply says "No current record." It's not even clear to me that this is an error (it doesn't say "error" anywhere). It's just a mysterious statement.

The title of the messagebox is the same as the title of the application (set through File | Options | Current Database). It isn't the title of any of the forms.

Everything works after I get the message, but it is just concerning/puzzling, and I'm trying to squash this bug.

I've stepped through all of the code that is firing during the form closing/opening operations. It all goes fine. It's when the original form has closed and the switchboard has already opened, and the last End Sub line is processed that you get that message.

I also strangely notice that it only happens if you press the button to return to the switchboard while viewing certain records in the non-switchboard form. And that behavior is consistent. It happens all the time when viewing some records, and not at all when viewing other records. But they all ARE records (contrary to the error message).

I've read many of the existing posts (at stackoverflow and at other websites) about similar "No current record" errors or messages, but none seem to apply here.

Any suggestions for what kind of things might cause this?

1

1 Answers

2
votes

Solved the problem, and thought it might be of use to others.

There was a line of code in the Form_Unload event for a subform to the main form. If that subform didn't have any records, then I get the message. It's tricky, because that code never gets "stepped through" when debugging.

So if you encounter a similar problem, check your subforms and their event procedures--particularly for the unload event, although other events might cause the problem too. In my case, I determined I didn't need that code, and deleted it. Now things work fine.