Results 1 to 5 of 5

Thread: Access Reports

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    UK
    Posts
    147

    Access Reports

    Can i run a report created in Access fron VB. If i can how can i do it?
    Mik706

  2. #2
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    If you're using Access 2000 and newer then you cannot run Access report as stand along - you will need to automate Access:
    VB Code:
    1. Private Sub Command1_Click()
    2. '=======================
    3.  
    4.     RunAccessReport App.Path & "\nwind.mdb", "Catalog"
    5.  
    6. End Sub
    7.  
    8. Public Sub RunAccessReport(strDB As String, strReport As String)
    9. '================================================================
    10. Dim AccessDB As Access.Application
    11.  
    12.     Set AccessDB = New Access.Application
    13.     AccessDB.OpenCurrentDatabase strDB
    14.     AccessDB.DoCmd.OpenReport strReport, acViewPreview
    15.     AccessDB.Visible = True
    16.     AccessDB.Quit acQuitSaveAll
    17.     Set AccessDB = Nothing
    18.  
    19. End Sub
    If you're using Access 97 then it should be an ocx out there from a third party to do that.
    Roy

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    You can use the same automation techinques with Access 97. That is where I first learned how. (For that matter, you can use this with Access 95 providing you are equipped with the proper references.)

  4. #4
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    If you take a look at the Access VBA help, there's a DoCmd.OpenReport method which'll help you out...

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  5. #5
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    You can use the same automation techinques with Access 97
    Oh, certainly. This can be used with any version of Access as long as the refences are OK.
    Roy

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