Results 1 to 3 of 3

Thread: Access Report

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 1999
    Location
    Freeport
    Posts
    204
    I search the Q and A but can not find a old question that helps. I learn how to use the Docmd.Openreport to print out a Access Report. But I also want to view it the same way you can crystal report thourgh the viewer. Is the any way I can ope the Access report in Access thourgh VB. Does some body have the code.

  2. #2
    New Member
    Join Date
    Apr 2000
    Posts
    1

    Cool

    The code below will print to the default printer, but I have figured out how to print preview it yet, if you do, please let me know how you did it.

    Hope it works for you. :-)
    ============================================================

    Private Sub Command1_Click() 'This code is trial code for printing reports.
    Dim oAccess As Object
    ' This was the toughest part. Getting the db name and location right! (and drive)
    Const gDBName = "C:\My Documents\dbMine.mdb"

    On Error GoTo Command1_Click_Error

    Screen.MousePointer = vbHourglass
    Set oAccess = CreateObject("Access.Application")

    With oAccess
    .OpenCurrentDatabase (gDBName)
    ' Here I changed to Preview report, "acViewPreview".
    ' Lookup OpenReport in Access Help, only trouble is it doesn't work
    .DoCmd.OpenReport "rptTest", acViewPreview
    End With

    Set oAccess = Nothing
    Screen.MousePointer = vbNormal
    Exit Sub
    Command1_Click_Error:
    MsgBox "Error: " & Err & " - " & Error
    End
    End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 1999
    Location
    Freeport
    Posts
    204
    Thanks

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