How to Access Reports in VB

Written by jaime avelar
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Access Reports in VB
Print Access reports in VB.NET. (background with binary data image by Pedro Nogueira from

Having the knowledge on how to access Microsoft Office Access reports using Microsoft Visual Basic.NET (VB.NET), can save you time when you need to access them from your VB.NET application. VB.NET is a computer programming language used to design Windows applications. Access is a relational database management system used to design local databases. Reports can be used to print compiled data in a user-friendly format for presentation purposes. In a few steps, you can write a VB.NET application to access and print a report in an Access database.

Skill level:

Things you need

  • Microsoft Visual Basic Express
  • Microsoft Office Access

Show MoreHide


  1. 1

    Open Microsoft Visual Basic Express, click "New Project..." then select "Windows Forms Application." Click "OK."

  2. 2

    Double-click "Button" on the "Toolbox" pane to add a new button control. Double-click "Button1" to open the "Form1.vb" module.

  3. 3

    Type the following under "Button1_Click" to declare an object variable:

    Dim oAccess As Microsoft.Office.Interop.Access.Application

  4. 4

    Type the following to start a new instance of Access:

        oAccess = New Microsoft.Office.Interop.Access.Application
  5. 5

    Type the following to open the Access database in exclusive mode:

        oAccess.OpenCurrentDatabase(filepath:="F:\DemandStudios\Archive\Northwind 2007.accdb", Exclusive:=True)

    Edit the path and type the path and name to your Access database.

  6. 6

    Type the following to preview a report named "Customer Address Book":

        oAccess.DoCmd.OpenReport(ReportName:="Customer Address Book", _

    Edit the "ReportName" and type a report in your Access database.

  7. 7

    Type the following to print the report named "Customer Address Book":

        ' Print a report named Sales:
        oAccess.DoCmd.OpenReport(ReportName:="Customer Address Book", _

    Edit the "ReportName" and type a report in your Access database.

    Press "F5" to run your program then click "Button1."

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.