No Current Record Error on Form Close but not 3021 (1 Viewer)

HairyArse

Registered User.
Local time
Today, 11:48
Joined
Mar 31, 2005
Messages
92
So I have a problem with my database that's been bugging me for some time now. I've read countless forum threads but to no avail and am pretty much at the end of my tether with it.

I'm using Windows 7 and Microsoft Access 2010. I use a MySQL back end and Microsoft Access front end. This problem occurs in Access 2003, 2007 and 2010. I am fully up to date with service packs and updates.

I have a main form containing a sub form. The main form displays live sales orders, the sub form items against the order. Sometimes there will be no currently live sales orders so no records to display. Occasionally, usually after I've saved or deleted the last live sales order, when I close the form I receive a "No Current Record" error.

Now before you say "use error handling", this doesn't work because this is not the 3021 variant of "No Current Record". The error code on this error is 0.

It would appear there are two versions of the "No Current Record" error.

I've even tried to handle errors with a code of 0 but for some reason this error still manages to escape my error handling.

Any suggestions?
 

boblarson

Smeghead
Local time
Today, 03:48
Joined
Jan 12, 2001
Messages
32,059
I think you are getting the error from somewhere other than your code which as the error handling. Look to your code on the main form or the subform whichever you have not been looking at, if you haven't looked at both.

Do you have any code in the on close or unload event of either form? Is there something on the subform's After Update event?

Also, I ran into some No Current Record issues with SQL Server (not MySQL) where using the VarChar(Max) caused a problem but when we specified VarChar(500) it fixed the problem. So maybe something like that is happening.
 

HairyArse

Registered User.
Local time
Today, 11:48
Joined
Mar 31, 2005
Messages
92
I have no code on the on Close, on Unload or After Update event for neither the main form or sub form.

I do use plenty of VarChars but I always set a character limit - though not as high as 500.

It's really frustrating because if I could figure out how to handle this specific error then I could just regularly run a COUNT query to determine when there are 0 records and handle it accordingly, but the fact it has an error code of 0 is what's causing the problem. I should also add that this isn't limited to just this one form either.
 

spikepl

Eledittingent Beliped
Local time
Today, 12:48
Joined
Nov 3, 2010
Messages
6,142
How exactly (and where) did you determine that the error code is 0? This sounds more like checking for error code in a location where there is no error. Did you check what happens in the Form's OnError event?
 

HairyArse

Registered User.
Local time
Today, 11:48
Joined
Mar 31, 2005
Messages
92
I applied some basic code to the on Error event to display the error message and error code and it came out as 0.

I have seen both variants. The 3021 No Current Record error actually displays the 3021 code but the version I'm suffering from just says "No Current Record" and nothing more.
 

HairyArse

Registered User.
Local time
Today, 11:48
Joined
Mar 31, 2005
Messages
92
Bump. Still experiencing this issue and really need to get to the bottom of it for the sake of my sanity.
 

vbaInet

AWF VIP
Local time
Today, 11:48
Joined
Jan 22, 2010
Messages
26,374
But you have error handling in other parts of your form? Put a break point on every event that has error handling in place, run the steps and step through your code.
 

boblarson

Smeghead
Local time
Today, 03:48
Joined
Jan 12, 2001
Messages
32,059
Also, I know you are using MySQL so it won't be able to be tested but if you post your frontend here and note what you have open and what you are doing when you get this error, we might be able to spot something. May not be as likely as if we had the whole thing but you never know.
 

HairyArse

Registered User.
Local time
Today, 11:48
Joined
Mar 31, 2005
Messages
92
I'll see what I can do about that Bob, but I have a whole login layer to disable and 90plus other forms to delete in order to get the size down, so I'm not sure how practical a move that is.

This behaviour is also exhibited on multiple other forms.
 

Users who are viewing this thread

Top Bottom