I wander with CurrentDB

F

Frank Dulk

I am with problems with the application that I developed, the one that
happens is the following: In my computer it rotates perfect, but in the it
conspires of the user, he/she gives mistake in the currentdb, Access speaks
that doesn't recognize the method currentdb, but I am going in the reference
and there this selected the MS DAO 3.5 Object Library, that is responsible
for those methods. also has the same references that mine conspires. I
already tried to uninstall and to install Access again and also Office but
it didn't solve.
Does anybody know him/it what it can be?
 
D

Dirk Goldgar

Allen Browne said:
Frank, CurrentDb creates a temporary reference.
This code does NOT work correctly:
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("MyTable")
Debug.Print rs.RecordCount '<==Error occurs here.

The problem is that CurrentDb exists only on line 2 because it was not
assigned to anything. The line successfully creates a new recordset,
but CurrentDb ceases to exist at the end of that line, and since rs
depends on CurrentDb, rs no longer exists at line 3.

Pardon me, Allen, but you're mistaken here. Unlike, say, the QueryDef
and TableDef objects, the Recordset object maintains a reference to its
parent object, so the temporary database object returned by CurrentDb
remains in existence for the lifetime of the recordset. The code above
will work without error, in the absence of other problems.
 
A

Allen Browne

Yes, you're right Dirk.
It fails with the TableDef object, but works fine with the Recordset object.

--
 
F

Frank Dulk

Which would my problem be then?

Dirk Goldgar said:
Pardon me, Allen, but you're mistaken here. Unlike, say, the QueryDef
and TableDef objects, the Recordset object maintains a reference to its
parent object, so the temporary database object returned by CurrentDb
remains in existence for the lifetime of the recordset. The code above
will work without error, in the absence of other problems.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
M

MikeB

Frank Dulk said:
I am with problems with the application that I developed, the one that
happens is the following: In my computer it rotates perfect, but in the it
conspires of the user, he/she gives mistake in the currentdb, Access speaks
that doesn't recognize the method currentdb, but I am going in the reference
and there this selected the MS DAO 3.5 Object Library, that is responsible
for those methods. also has the same references that mine conspires. I
already tried to uninstall and to install Access again and also Office but
it didn't solve.
Does anybody know him/it what it can be?

Frank says: "Access speaks that doesn't recognize the method currentdb". Wouldn't that be
indicative that he isn't explicitly declaring the Object model?

dim db as Database

instead of:
dim db as DAO.Database
 
D

Douglas J. Steele

MikeB said:
Frank says: "Access speaks that doesn't recognize the method currentdb". Wouldn't that be
indicative that he isn't explicitly declaring the Object model?

dim db as Database

instead of:
dim db as DAO.Database

While there are many objects that need to be explicitly declared as DAO.,
Database isn't actually one of them. The reason for needing to disambiguate
is because objects with the same name exist in more than one model (in this
case, in both the ADO and DAO models). The objects with names in common
between ADO and DAO are Connection, Error, Errors, Field, Fields, Parameter,
Parameters, Property, Properties and Recordset.
 
F

Frank Dulk

The version of MsDao, in the it conspires of the user it is the version 3.6
in Access 97, Windows is it Me.
In the machine that I developed the application it is MsDao the version it
is 3.5 in Access 97, with Win98.
Will it be that the problem is because of the version of the they Dao?
The mistake that happens is the following:
" Method of Failed " Object and he mark the currentdb.
 
F

Frank Dulk

As explained by you, the version of the they DAO has to be to 3.5x, I
installed reference it is same library, but now gives him the following
mistake " it Happened a mistake in msaccess.exe, close - the and restart her
it conspires ", I made the instructions of the mistake, but nothing doesn't
happen. I think will have to format the machine and to reinstall everything
again.
 
D

Dirk Goldgar

Frank Dulk said:
As explained by you, the version of the they DAO has to be to 3.5x, I
installed reference it is same library, but now gives him the
following mistake " it Happened a mistake in msaccess.exe, close -
the and restart her it conspires ", I made the instructions of the
mistake, but nothing doesn't happen. I think will have to format the
machine and to reinstall everything again.

That may be a drastic solution to your problem, but I can't tell from
here exactly what may be wrong. If you correctly installed and
registered the right version of DAO, then try to ensure that both
systems are running the same version and SR/SP level of Access 97 and
Jet. If not, I'd certainly start with bringing both machines up to the
same level. If it still doesn't work, you could try uninstalling and
reinstalling Access or Office on the problem machine, and if that
doesn't work, you could try using Microsoft's untility to *completely*
remove Office 97 from the problem machine, and then reinstall, as
instructed here (for Windows 2000, ME, and XP):

http://support.microsoft.com/default.aspx?scid=kb;[LN];254250

or here (for Windows 95, 98, or NT 4.0):

http://support.microsoft.com/default.aspx?scid=kb;[LN];158658
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top