Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / July 2004

Tip: Looking for answers? Try searching our database.

PRB with accessing Ms Access from .NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Konrad Rotuski - 02 Jul 2004 14:09 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.