Setting Object References in Access Modules by using VBA Code

D

Dave Reynolds

One of the issues that seems to arise with Access is a migration from an older environment (like Windows 98 or 2000) to XP. When you create the new database in XP, the module code does not compile. This is because some of the methods that were valid in the old environment are not necessarily recognized in the the new. This can be alleviated by opening up any module created in the Design mode and then clicking Tools and then references and setting certain library references by checking off the items needed to recognize "backward compatibility".

My question is, is there a way to set these flags on automatically by writing a Visual Basic Access function and then executing it when the database launches ?
 
T

Tim Ferguson

My question is, is there a way to set these flags on automatically by
writing a Visual Basic Access function and then executing it when the
database launches ?

Rumour has it that Access 2003 sets the default back to DAO, but I don't
know if it's true or not. Would be nice if it was a program default, but
there you go...


Tim F
 
D

Douglas J. Steele

Tim Ferguson said:
Rumour has it that Access 2003 sets the default back to DAO, but I don't
know if it's true or not. Would be nice if it was a program default, but
there you go...

DAO is there, but I'm not sure it's the default. Both ADO and DAO are
present, but I'm not sure which is higher in the sequence, as I haven't
installed 2003 yet.
 
D

Douglas J. Steele

You can use the References collection's AddFromFile or AddFromGUID methods
to add a reference.

You only need to do it once, as the references are stored in the MDB file
itself, not in Access.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Dave Reynolds said:
One of the issues that seems to arise with Access is a migration from an
older environment (like Windows 98 or 2000) to XP. When you create the new
database in XP, the module code does not compile. This is because some of
the methods that were valid in the old environment are not necessarily
recognized in the the new. This can be alleviated by opening up any module
created in the Design mode and then clicking Tools and then references and
setting certain library references by checking off the items needed to
recognize "backward compatibility".
My question is, is there a way to set these flags on automatically by
writing a Visual Basic Access function and then executing it when the
database launches ?
 
T

Tim Ferguson

Stupid typo: that should be "program option"...
DAO is there, but I'm not sure it's the default. Both ADO and DAO are
present, but I'm not sure which is higher in the sequence, as I haven't
installed 2003 yet.

All the best


Tim F
 

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