Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VSTO 2005 Access

Posted on 2006-11-13
4
Medium Priority
?
208 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 2000 total points
ID: 17931958
Import interop namespace then ....

Imports Microsoft.Office.Interop
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

609 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