Hi
We have old application which was wrotten in VB6, it has Access type library
referenced in Project_Name.vbp :
Reference=*\G{4AFFC9A0-5F99-101B-AF4E-00AA003F0F07}#8.0#0#..\..\Program
Files\Microsoft Office\Office\MSACC8.OLB#Microsoft Access 8.0 Object Library
this application works fine on Access ver 2000 and on Access 2003 with .mdb
with certificates
currently we want to port that app from VB6 to VB.NET, on my machine, where
i have Office XP installed everything works fine, when i move .exe to
machine where Office 2000 is installed, it returns with error 'Object
reference not set to an instance of object' on line :
accessobj.OpenCurrentDatabase()
we use RCW created by VS.NET
accessobj is created successfully with New Access.Application , here is some
code :
accessobj = New Access.Application 'No error
'...
accessobj.DBEngine.CompactDatabase("..", "...") 'No error
'...
accessobj.OpenCurrentDatabase("..") 'Error Here !!!
in metadata of Interop.Access.dll created by VS.NET there is the same CLSID
referenced as in old VB6 project.
is this error caused by different version of Access installed on that
machine .. or maybe i'm doing something wrong .. ?
we want this app to be working with possibly any version of Access (a least
any >= 2000).
is there any simple way to accomplish this ?
any help appreciated
regards, Konrad
Phil Wilson - 05 Jul 2004 16:42 GMT
Can't see the rest of your code in that example, but 'Object reference not
set to an instance of object' means that an object (such as accessobj) is
null.

Signature
Phil Wilson
[MVP Windows Installer]
> Hi
>
[quoted text clipped - 37 lines]
>
> regards, Konrad
Konrad Rotuski - 06 Jul 2004 13:53 GMT
> Can't see the rest of your code in that example, but 'Object reference not
> set to an instance of object' means that an object (such as accessobj) is
> null.
thats not the case here, i checked against this case and it for sure is not
null
the problem here was that OpenCurrentDatabase function has changed between
version 9.0 and 10.0 of Access COM object (actually the header has changed,
its enough), and thats why it returned Null Pointer Exception
i've solved this problem by compiling application with ver 9.0 of Access COM
installed on system (and Interop.Access.dll was generated on this system
too), ver 10.0 seems backward compatible with 9.0, at least with regard to
methods i need. For example .Version member is not implemented in ver 9.0