Results 1 to 3 of 3

Thread: Access Reports In VB

  1. #1
    vbjohn
    Guest

    Exclamation Access Reports In VB

    How do I view a selected Access report in Visual Basic?

    Any Code examples would be great...

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    VB Code:
    1. 'Add a reference to the Access X.X Object Library
    2.  
    3. Option Explicit
    4. Private acc As Access.Application
    5.  
    6. Private Sub Command1_Click()
    7.     Dim view As Long
    8.     Set acc = New Access.Application
    9.     acc.OpenCurrentDatabase ("C:\TEST.mdb")
    10.     acc.DoCmd.OpenReport "ReportName", acViewNormal 'acViewNormal means the report is just printed.
    11.     acc.CloseCurrentDatabase
    12.     Set acc = Nothing
    13. End Sub

    u have to find the constant to use instead of acViewNormal, but it should get u started
    -= a peet post =-

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. cmdPrintPreview_Click()
    2.  Dim Axs As Access.Application
    3.  Set Axs = CreateObject("Access.Application")
    4.  Axs.Visible = True
    5.  Axs.RunCommand acCmdAppMaximize
    6.  Axs.OpenCurrentDatabase ("c:\YourPath\YourMdb.mdb")
    7.  Axs.DoCmd.OpenReport "YourAccessReport", acViewPreview
    8.  Axs.DoCmd.Maximize
    9. End Sub
    10.  
    11. Private Sub Form_Unload(Cancel As Integer)
    12. On Error Resume Next
    13. Axs.Quit
    14. Set Axs = Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width