Error Codes 7787 (1 Viewer)

FuzMic

DataBase Tinker
Local time
Today, 09:19
Joined
Sep 13, 2006
Messages
719
Hi members

Recently i come across 2 error codes, namely 7787 & 3021 when i try to exit certain opened forms in WinXp.sp3 & Access02. Since accesserror(7787) gives no info, it is difficult to pin the problem. Error 3021 is defined as "No current Record".

Any suggestion to a listing of all types of error besides those from Access.
Any pointer as to why these two errors when i try to close the form.

Thanks for any help.
 
Last edited:

Trevor G

Registered User.
Local time
Today, 02:19
Joined
Oct 1, 2009
Messages
2,341
I am not sure what actions you are performing on the form or what code you have.

I have just run this code to see what the Errors are in the Debug Window. Not much help without more information.

Sub errornum()
Dim ErrorNumber
For ErrorNumber = 3020 To 3021
Debug.Print ErrorNumber & Error(ErrorNumber)
Next ErrorNumber
End Sub

Sub errornum1()
Dim ErrorNumber
For ErrorNumber = 7786 To 7787
Debug.Print ErrorNumber & Error(ErrorNumber)
Next ErrorNumber
End Sub
 

FuzMic

DataBase Tinker
Local time
Today, 09:19
Joined
Sep 13, 2006
Messages
719
Thanks Trevor

At least i get 7787: Application-defined or object-defined error.

It was basically an opened form OFrm that call a function Fcn in a module. In the function there is a ADODB.recordset RSet that do a select on the same table ULTbl that OFrm has as its RecordSource.

The info from the RSet was used to create a number of records in another table (totally unrelated to the ULTbl; also no changes to ULTbl as Rset remains unchanged).

The 7787 error occur if there there is only one record in the RSet and the function Fcn uses "Do while not RSet.EOF". By not having this line for single recordcount of the FNcn, there is no error.

The RSet was set = nothing when the Fcn ends. 7787 error occur at the closing of the OFrm.

Sorry my real codes are all messy to put up; i think the above may give you a clue. Cheers!
 

boblarson

Smeghead
Local time
Yesterday, 18:19
Joined
Jan 12, 2001
Messages
32,059
FuzzMic:

Instead of using Do While Not RSet.EOF change it to

Do Until RSet.EOF
 

FuzMic

DataBase Tinker
Local time
Today, 09:19
Joined
Sep 13, 2006
Messages
719
Bob it work!!, A big thank you but what's the significance? ie if u would enlighten the pupil. The Peace I leave with you.
 
Last edited:

boblarson

Smeghead
Local time
Yesterday, 18:19
Joined
Jan 12, 2001
Messages
32,059
Bob it work!!, A big thank you but what's the significance? ie if u would enlighten the pupil. The Peace I leave with you.

This is kind of hard for me to be able to explain. Perhaps someone else with actual programming training can jump in here and provide an answer if they can. I just know that if one doesn't give you the results you are looking for, trying the other is something you can do. To tell you the truth, it does confuse me a bit when talking about a Do WHILE vs Do UNTIL instead of just the difference between a WHILE and DO.
 

FuzMic

DataBase Tinker
Local time
Today, 09:19
Joined
Sep 13, 2006
Messages
719
Sorry Bob

I got it wrong, it DID NOT work ie using either UNTIL or DO WHILE, the problem persisted at quiting the form in the circumstances as described. So we are in square one.
 

boblarson

Smeghead
Local time
Yesterday, 18:19
Joined
Jan 12, 2001
Messages
32,059
Post the code so we can see what is there and how it relates. The amount you posted before may not be sufficient to see the problem then.
 

FuzMic

DataBase Tinker
Local time
Today, 09:19
Joined
Sep 13, 2006
Messages
719
Bob the codes as i mentioned early is too messy to make sense as it goes from a form to a function and then back to the form; then further down the line when the form is made to close, the error pops up.

Meanwhile let me tinker on & see if something happen outside the form that makes the closing illegal. Thanks as always.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 02:19
Joined
Sep 12, 2006
Messages
15,658
out of interest, i googled error 7787, and saw it described as a write conflict error - which probably fits in with the no current record error, in that it is imperfect handling of the recordsets.

It sounds like the "another user edited your record" type error. Maybe you are modifying the same record in 2 different bits of code.

so do you get this on every record? or just at the end of the record set? if the latter, all of this may be connected with the loop control - especially as you noted your code was quite complex

anyway, the difference between while and until is generally this. A do...until runs at least once. A do while ... loop may not run at all.

You have to be careful to decide how to manage your loops, especially at the end condition. If your code is very complex, this is most likely the problem

To be honest, I never use do loop, and would not even be 100% sure of the syntax without checking. I learned programming in pascal, where the constructs were repeat until .. and while {block}. (The equivalent in VBA is while ... wend). Again repeat .. until executes at least once, but the while {block} may not execute at all. So the latter can be used in all cases, unlike the former.

So I only ever use while .. wend, which gives perfect control in every situation, as I find the syntax easier to read and use.

eg this snippet waits for a form to close - (note that the formisopen function is user-defined.)
Code:
while formisopen("someform")
  doevents
wend
 
Last edited:

FuzMic

DataBase Tinker
Local time
Today, 09:19
Joined
Sep 13, 2006
Messages
719
Thanks Dave, that's great insight to give me more ways to skin the cat. Have a good day.

Just another question, in Access VB there seem to be Exit While. Is this true. Is the GoTo the way out?
 
Last edited:

Users who are viewing this thread

Top Bottom