Error 3420 with DBEngine(0)(0) 
Author Message
 Error 3420 with DBEngine(0)(0)

Hi,

We talked about the usage of CurrentDb() and DBEngine(0)(0)
in German NGs...

Following code creates an Error 3420 in A2k2, but not in
Access97

Can anybody anything say about this difference ?

'------------------------------------------------------
Sub Test()
Dim db as DAO.Database, rs as DAO.Recordset

    Set db = DBEngine(0)(0)
    Set rs = db.OpenRecordset("Irgendwo")

    DoAnythingHere

    rs.Edit
    'on this Position Err = 3420
    rs.Close
End Sub

Sub DoAnythingHere()
Dim db as DAO.Database, rs as DAO.Recordset

    Set db = DBEngine(0)(0)
    Set rs = db.OpenRecordset("Irgendwas")

    rs.Close: Set rs = Nothing
    db.Close: Set db=Nothing

End Sub



Fri, 30 Apr 2004 17:00:24 GMT  
 Error 3420 with DBEngine(0)(0)
Is this not kind of irrelevant?

If your code does stupid thing (like closing things you did not open?) and
bad things happen, then your course of action is clear.

--
MichKa

Michael Kaplan
(principal developer of the MSLU)
Trigeminal Software, Inc.  -- http://www.trigeminal.com/
the book -- http://www.i18nWithVB.com/


Quote:
> Hi,

> We talked about the usage of CurrentDb() and DBEngine(0)(0)
> in German NGs...

> Following code creates an Error 3420 in A2k2, but not in
> Access97

> Can anybody anything say about this difference ?

> '------------------------------------------------------
> Sub Test()
> Dim db as DAO.Database, rs as DAO.Recordset

>     Set db = DBEngine(0)(0)
>     Set rs = db.OpenRecordset("Irgendwo")

>     DoAnythingHere

>     rs.Edit
>     'on this Position Err = 3420
>     rs.Close
> End Sub

> Sub DoAnythingHere()
> Dim db as DAO.Database, rs as DAO.Recordset

>     Set db = DBEngine(0)(0)
>     Set rs = db.OpenRecordset("Irgendwas")

>     rs.Close: Set rs = Nothing
>     db.Close: Set db=Nothing

> End Sub



Sat, 01 May 2004 02:22:25 GMT  
 Error 3420 with DBEngine(0)(0)
Check out Microsoft Knowledgebase Article Q200592 and see
if it applies to your situation.

Quote:
>-----Original Message-----
>Hi,

>We talked about the usage of CurrentDb() and DBEngine(0)
(0)
>in German NGs...

>Following code creates an Error 3420 in A2k2, but not in
>Access97

>Can anybody anything say about this difference ?

>'------------------------------------------------------
>Sub Test()
>Dim db as DAO.Database, rs as DAO.Recordset

>    Set db = DBEngine(0)(0)
>    Set rs = db.OpenRecordset("Irgendwo")

>    DoAnythingHere

>    rs.Edit
>    'on this Position Err = 3420
>    rs.Close
>End Sub

>Sub DoAnythingHere()
>Dim db as DAO.Database, rs as DAO.Recordset

>    Set db = DBEngine(0)(0)
>    Set rs = db.OpenRecordset("Irgendwas")

>    rs.Close: Set rs = Nothing
>    db.Close: Set db=Nothing

>End Sub

>.



Sat, 01 May 2004 02:55:06 GMT  
 Error 3420 with DBEngine(0)(0)
Hi,

Quote:
> Is this not kind of irrelevant?

May be.. :-)

Quote:
> If your code does stupid thing
> like closing things you did not open

Sorry, I don't understand that...

JA



Sat, 01 May 2004 06:40:26 GMT  
 Error 3420 with DBEngine(0)(0)
He's pointing out that in your Sub DoAnythingHere, you have

    Set db = DBEngine(0)(0)

    db.Close

You are closing the current database, though you didn't open it.  Possibly
this is the source of your error.

--
Dirk Goldgar
www.datagnostics.com

(to reply via e-mail, remove NOSPAM from address)


Quote:
> Hi,

> > Is this not kind of irrelevant?

> May be.. :-)

> > If your code does stupid thing
> > like closing things you did not open

> Sorry, I don't understand that...

> JA



Sat, 01 May 2004 07:23:21 GMT  
 Error 3420 with DBEngine(0)(0)
Hi,

Quote:
> You are closing the current database, though you didn't open it.  Possibly
> this is the source of your error.

Can you give me a little example, how you would do that ?

JA



Sat, 01 May 2004 07:53:01 GMT  
 Error 3420 with DBEngine(0)(0)
It's not a matter of something you should do, it's something you're doing
that you shouldn't do.  If you really have code like this:

    '---- partial quote of erroneous code ----
    Set db = DBEngine(0)(0)

    db.Close: Set db=Nothing
    '---- end quote of erroneous code ----

you should remove the "db.Close" statement so it reads like this:

    '---- corrected code ----
    Set db = DBEngine(0)(0)

    Set db=Nothing
    '---- end corrected code ----

Now, the code you quoted is probably not the complete code of your routine,
and it may even be that this is not the cause of the error message you're
getting.  But it is worth testing, and it is still the case that you
shouldn't close objects that you don't open.  Your object db is not assigned
its value by an OpenDatabase() call, so you should not close it.

--
Dirk Goldgar
www.datagnostics.com

(to reply via e-mail, remove NOSPAM from address)


Quote:
> Hi,

> > You are closing the current database, though you didn't open it.
Possibly
> > this is the source of your error.

> Can you give me a little example, how you would do that ?

> JA



Sat, 01 May 2004 08:46:44 GMT  
 Error 3420 with DBEngine(0)(0)
Hi, Dirk

Quote:
> and it may even be that this is not the cause of the error message you're
> getting

It is...   Thanks ! I understand now!

cu
JA



Sat, 01 May 2004 09:14:45 GMT  
 Error 3420 with DBEngine(0)(0)
Hi

We now know :

This is shit code
Where does this fine error comes from

But...

Why does A97 ignores that all ?

That was the question basicly...

BTW: sorry  for my english, i do my best...



Sat, 01 May 2004 09:20:20 GMT  
 Error 3420 with DBEngine(0)(0)
Now you've reached an area where I can only speculate, while Michael Kaplan
could probably tell you for certain.  My guess (and it's only that) would be
that when you tell Access 97 to close DBEngine(0)(0) or CurrentDb(), it just
ignores you, while in Access 2000, it actually closes (at least partially)
and reopens, thereby invalidating any objects that were based on it.  But
this is only a guess, and not a very informed one at that.

MichKa, would you care to jump back in and clear this up?

--
Dirk Goldgar
www.datagnostics.com

(to reply via e-mail, remove NOSPAM from address)


Quote:
> Hi

> We now know :

> This is shit code
> Where does this fine error comes from

> But...

> Why does A97 ignores that all ?

> That was the question basicly...

> BTW: sorry  for my english, i do my best...



Sat, 01 May 2004 11:40:21 GMT  
 Error 3420 with DBEngine(0)(0)
Hi.
Why would you want to close DBEngine(0)(0)?
You should only close what you've opened.
HTH.
---
(-: a s i l b a . p t ;-)


Quote:
> Hi,

> We talked about the usage of CurrentDb() and DBEngine(0)(0)
> in German NGs...

> Following code creates an Error 3420 in A2k2, but not in
> Access97

> Can anybody anything say about this difference ?

> '------------------------------------------------------
> Sub Test()
> Dim db as DAO.Database, rs as DAO.Recordset

>     Set db = DBEngine(0)(0)
>     Set rs = db.OpenRecordset("Irgendwo")

>     DoAnythingHere

>     rs.Edit
>     'on this Position Err = 3420
>     rs.Close
> End Sub

> Sub DoAnythingHere()
> Dim db as DAO.Database, rs as DAO.Recordset

>     Set db = DBEngine(0)(0)
>     Set rs = db.OpenRecordset("Irgendwas")

>     rs.Close: Set rs = Nothing
>     db.Close: Set db=Nothing

> End Sub



Sat, 01 May 2004 09:29:02 GMT  
 Error 3420 with DBEngine(0)(0)
You must be kidding, you want an example of how to NOT do something?

Well, closing is done via the .CLOSE method. Don't call it, if you did not
OPEN the object!

--
MichKa

Michael Kaplan
(principal developer of the MSLU)
Trigeminal Software, Inc.  -- http://www.trigeminal.com/
the book -- http://www.i18nWithVB.com/


Quote:
> Hi,

> > You are closing the current database, though you didn't open it.
Possibly
> > this is the source of your error.

> Can you give me a little example, how you would do that ?

> JA



Tue, 04 May 2004 03:52:39 GMT  
 Error 3420 with DBEngine(0)(0)
Did you OPEN the database?

No, you are using one already open.

So do not close it.

--
MichKa

Michael Kaplan
(principal developer of the MSLU)
Trigeminal Software, Inc.  -- http://www.trigeminal.com/
the book -- http://www.i18nWithVB.com/


Quote:
> Hi,

> > Is this not kind of irrelevant?

> May be.. :-)

> > If your code does stupid thing
> > like closing things you did not open

> Sorry, I don't understand that...

> JA



Tue, 04 May 2004 03:51:47 GMT  
 Error 3420 with DBEngine(0)(0)
Well, perhaps they did not spend as much time guarding developer wannabees
from doing things they should not?

Makes no difference, when doing it right solves the problem.

--
MichKa

Michael Kaplan
(principal developer of the MSLU)
Trigeminal Software, Inc.  -- http://www.trigeminal.com/
the book -- http://www.i18nWithVB.com/


Quote:
> Hi

> We now know :

> This is shit code
> Where does this fine error comes from

> But...

> Why does A97 ignores that all ?

> That was the question basicly...

> BTW: sorry  for my english, i do my best...



Tue, 04 May 2004 03:53:54 GMT  
 Error 3420 with DBEngine(0)(0)
Well, I have been out of that source for too long, especially since this is
obviously a regression (this problem existede in Jet 2.x but was fixed).

--
MichKa

Michael Kaplan
(principal developer of the MSLU)
Trigeminal Software, Inc.  -- http://www.trigeminal.com/
the book -- http://www.i18nWithVB.com/


Quote:
> Now you've reached an area where I can only speculate, while Michael
Kaplan
> could probably tell you for certain.  My guess (and it's only that) would
be
> that when you tell Access 97 to close DBEngine(0)(0) or CurrentDb(), it
just
> ignores you, while in Access 2000, it actually closes (at least partially)
> and reopens, thereby invalidating any objects that were based on it.  But
> this is only a guess, and not a very informed one at that.

> MichKa, would you care to jump back in and clear this up?

> --
> Dirk Goldgar
> www.datagnostics.com

> (to reply via e-mail, remove NOSPAM from address)



> > Hi

> > We now know :

> > This is shit code
> > Where does this fine error comes from

> > But...

> > Why does A97 ignores that all ?

> > That was the question basicly...

> > BTW: sorry  for my english, i do my best...



Tue, 04 May 2004 03:54:43 GMT  
 
 [ 15 post ] 

 Relevant Pages 

1. error 3420 -object invalid or no longer set

2. Runtime Error 3420

3. Acc2000 : 3420 error

4. Error 3420 using a collection

5. Error 3420 on Compact DB

6. Error (3420) when closing a database

7. Acc 97 : Err 3420

8. Newbie: 3420 Object Invalid or no longer set

9. Newbie: 3420 Object Invalid or no longer set

10. After Rollback Error 3420 'Object invalid or no longer set'

11. Newbie: 3420 Object Invalid or no longer set Error???

12. Error 3420 Object Invalid or no longer set...Why?

 

 
Powered by phpBB® Forum Software