Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

VSTO 2005 Access

Hi

I am trying to use the following code to manipulate Access from VSTO 2005 and am
getting the error "Type Access.Aplication is not defined"

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
        ' instantiate Access
        Dim objAccess As Access.Application
        objAccess = New Access.ApplicationClass
 
        ' make Access visible to the user
        objAccess.Visible = True
 
        ' open the Northwind sample database
        objAccess.OpenCurrentDatabase(filepath:="C:\Program Files\Microsoft Office\Office11\Samples\Northwind.mdb")
 
        ' identify the report you want to display
        objAccess.DoCmd.SelectObject(ObjectName:="Sales by Category", InDatabaseWindow:=True, _
        ObjectType:=Access.AcObjectType.acReport)
 
        ' show the report
        objAccess.DoCmd.OpenReport(ReportName:="Sales by Category", _
                    View:=Access.AcView.acViewPreview)
 
        objAccess = Nothing
 
    End Sub
0
Murray Brown
Asked:
Murray Brown
  • 3
1 Solution
 
riyazthadCommented:
You missed COM reference to Access.

Add a COM reference.

Thad
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
I have done that
0
 
riyazthadCommented:
Could you create an instance of object 'Access.Application'? Where you are getting error exactly?

0
 
riyazthadCommented:
Import interop namespace then ....

Imports Microsoft.Office.Interop
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now