Solved

VSTO 2005 Access

Posted on 2006-11-13
4
190 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:murbro
  • 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:murbro
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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

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…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

831 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