Home All Groups Group Topic Archive Search About

Error trying to connect to Access DB in VB.Net

Author
12 Sep 2006 5:38 AM
Christie
I am writing a VB.NEt application in Visual Studio 2005 that will
automate an Access database.  When I try the following

Dim oAccess as Access.Application

I get this error: "Type 'Access.Application' is not defined".

I don't know if I am missing a reference or not.  Could someone please
show me the correct way.

I already have the following references in my app:
Microsoft Access 11.0 Obj Library
Microsoft ActiveX Data Objects 2.5 Library
Microsoft DAO 3.6 Obj Library
Microsoft Office 11.0 Object Library
Microsoft Visual Basic for Applications Extensibility 5.3

Thanks

Author
12 Sep 2006 11:24 AM
rowe_newsgroups
Unfortunately I could not replicate this error. Does the error occur
when you build or during runtime? If it builds have you tried stepping
through the code to pinpoint the problem line? Any extra info might
help find the problem. Also, to create an intance of the
Access.Application you need to throw in the "New" keyword. i.e. Dim
oAccess as New Access.Application. Also, what exactly are you trying to
automate? You may not even need to create the Access.Application
object.

Thanks,

Seth

Christie wrote:
Show quoteHide quote
> I am writing a VB.NEt application in Visual Studio 2005 that will
> automate an Access database.  When I try the following
>
> Dim oAccess as Access.Application
>
> I get this error: "Type 'Access.Application' is not defined".
>
>  I don't know if I am missing a reference or not.  Could someone please
> show me the correct way.
>
> I already have the following references in my app:
> Microsoft Access 11.0 Obj Library
> Microsoft ActiveX Data Objects 2.5 Library
> Microsoft DAO 3.6 Obj Library
> Microsoft Office 11.0 Object Library
> Microsoft Visual Basic for Applications Extensibility 5.3
>
> Thanks
Author
13 Sep 2006 12:52 AM
Christie
Seth..thanks you are right..I did not need to create the
Access.Application object..used an ADODB connectin instead...

rowe_newsgroups wrote:
Show quoteHide quote
> Unfortunately I could not replicate this error. Does the error occur
> when you build or during runtime? If it builds have you tried stepping
> through the code to pinpoint the problem line? Any extra info might
> help find the problem. Also, to create an intance of the
> Access.Application you need to throw in the "New" keyword. i.e. Dim
> oAccess as New Access.Application. Also, what exactly are you trying to
> automate? You may not even need to create the Access.Application
> object.
>
> Thanks,
>
> Seth
>
> Christie wrote:
> > I am writing a VB.NEt application in Visual Studio 2005 that will
> > automate an Access database.  When I try the following
> >
> > Dim oAccess as Access.Application
> >
> > I get this error: "Type 'Access.Application' is not defined".
> >
> >  I don't know if I am missing a reference or not.  Could someone please
> > show me the correct way.
> >
> > I already have the following references in my app:
> > Microsoft Access 11.0 Obj Library
> > Microsoft ActiveX Data Objects 2.5 Library
> > Microsoft DAO 3.6 Obj Library
> > Microsoft Office 11.0 Object Library
> > Microsoft Visual Basic for Applications Extensibility 5.3
> >
> > Thanks