Results 1 to 5 of 5

Thread: Calling for report

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2005
    Location
    Lebanon
    Posts
    24

    Calling for report

    Hello all,
    so if I have a report on Access, can I call it and place it the same in VB as if it was on Access?
    Thanks

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Calling for report

    You can either

    - automate MS Access to run that report directly (Access must be installed)
    - or create new report in VB similar to one in Access using any available report designer (DataReport, Crystal Reports, Active Reports, etc)

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 2005
    Location
    Lebanon
    Posts
    24

    Re: Calling for report

    so how can automate access?

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Calling for report

    Something like this will do it:
    VB Code:
    1. Public Sub RunAccessReport(strDB As String, strReport As String, _
    2.                            Optional strFilter As String = "", _
    3.                            Optional strWhere As String = "")
    4. '===================================================================
    5. Dim AccessDB As Object
    6.  
    7.     Set AccessDB = CreateObject("Access.Application")
    8.     AccessDB.OpenCurrentDatabase strDB
    9.     AccessDB.DoCmd.OpenReport strReport, acViewPreview, strFilter, strWhere
    10.     AccessDB.Visible = True
    11.  
    12. End Sub
    13.  
    14. 'usage:
    15. Private Sub Command1_Click()
    16.     RunAccessReport App.Path & "\nwind.mdb", "Catalog"
    17. End Sub

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Calling for report

    Moved to reporting section

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