Solved

VSTO 2005 Access

Posted on 2006-11-13
4
201 Views
Last Modified: 2010-04-23
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
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 6

Expert Comment

by:riyazthad
ID: 17931783
You missed COM reference to Access.

Add a COM reference.

Thad
0
 

Author Comment

by:Murray Brown
ID: 17931797
I have done that
0
 
LVL 6

Expert Comment

by:riyazthad
ID: 17931858
Could you create an instance of object 'Access.Application'? Where you are getting error exactly?

0
 
LVL 6

Accepted Solution

by:
riyazthad earned 500 total points
ID: 17931958
Import interop namespace then ....

Imports Microsoft.Office.Interop
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question