CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2001
    Location
    County Durham, England
    Posts
    238

    Running a MS Access Report From VB6

    Hi All,

    Have any of you any idea how to Print/Preview a Report which has been created in an Access Database From Visual Basic. I am developing an application which needs to generate quite complex timetables which I can do in Access using the SubReports etc, but not with the DataReport / Data Environment within VB so it would be nice to be ale to just Preview and Print the reports I've already done, Help !!!




  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Running a MS Access Report From VB6

    Public Sub RunReport(strDatabase As String, strReport As String)
    '=============================================================================
    'add ref to Acces 8.0 ( or whatever Access you have)
    Dim mobjAccess As Object

    Set mobjAccess = New Access.Application
    ' Open the database
    mobjAccess.OpenCurrentDatabase strDatabase
    ' Open the report in preview mode using the DoCmd object
    mobjAccess.DoCmd.OpenReport strReport, acPreview
    ' Maximize the report window
    mobjAccess.DoCmd.Maximize
    ' Show the Access window
    mobjAccess.Visible = True
    Set mobjAccess = Nothing

    End Sub

    'to print report use acViewNormal instead of acPreview. and of course you don't need lines to miximize window and make Accesss visible


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Mar 2001
    Location
    County Durham, England
    Posts
    238

    Re: Running a MS Access Report From VB6

    Cheers Louri for your speedy response, Just one question, will your code work for machines which do not have MS-Access Installed. Its Just not all staff who will be using it have MS-Access Installed ( Our IT Dept is a bit tight on licences ), this is why I was hesitating on going down this route . .


  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Running a MS Access Report From VB6

    No it will not. If you don't want to install Access then create your own report and run it from VB.


    Rate it if it helped you.

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  5. #5
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Running a MS Access Report From VB6

    It requires ms-access installed.
    Name is Iouri, if I am not wrong...
    :-)



    Special thanks to Lothar "the Great" Haensler, Tom Archer, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  6. #6
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Running a MS Access Report From VB6

    Truly? How bad I quickly answer the wrong one!
    Thanks for sharing, Iouri

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  7. #7
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Out of votes...

    I will rate you tomorrow...

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  8. #8
    Join Date
    Mar 2001
    Location
    County Durham, England
    Posts
    238

    Re: Running a MS Access Report From VB6

    Sorry for the Speeling mistake on your name Iouri, and I will be rating your post, but can I clarify that If I have already created a report in MS-Access 2000, and this Database file is sitting on the server, will your code preview the report on a machine which doesn't have Access Installed. ( Sorry to be Thick ! )


  9. #9
    Join Date
    May 2001
    Posts
    36

    Re: Running a MS Access Report From VB6

    I suggest you try EasyGrid OCX. It's very easy and powerful.
    Maybe it will help you.
    Download it from http://www.share2.com/easygrid/



  10. #10
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Running a MS Access Report From VB6

    I think that you cannot preview report on th ecomputer that does not have MS Access installed

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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

Featured