Results 1 to 11 of 11
  1. #1
    Join Date
    Dec 2003
    Location
    Johannesburg, South Africa
    Posts
    18

    Unanswered: Accessing of MS ACCESS 97 Reports from VB6

    Hi everyone,
    Does anyone know how to access the MS Access reports trhough Visual Basic Version 6?
    Divvy

  2. #2
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238

    Re: Accessing of MS ACCESS 97 Reports from VB6

    Originally posted by tupiex
    Hi everyone,
    Does anyone know how to access the MS Access reports trhough Visual Basic Version 6?
    Hello...

    I'm not sure what you mean by this question... Do you mean reports inside a particular database?... If so, you can use automation to get at the reports... by declaring an Access Application, opening the database in question, etc... all inside your VB code... I've done VB front end's and Access back end databases before... Never had a problem...

    Look up Automation in any Microsoft Office application Help and you'll get some information and examples... or post back for more help...

    If I'm completely misunderstanding your question, I apologize...
    HTH...

  3. #3
    Join Date
    Dec 2003
    Location
    Johannesburg, South Africa
    Posts
    18

    Talking Explaination

    Hi

    Sorry for any misunderstanding....

    I have an MS Access 97 database with some reports in it and I wanted to know if it would be possible to access these reports from Visual basic 6?

    I have been working with VB only a short while so I do not know all the bells and whistles around the product but I have found that the VB reporting , in my opinion (not that I am an expert), is not as good as in MS Access.

    Thus I was wondering if I read/display and print these reports using VB code.
    Divvy

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487
    Try this.......

    Code:
    Dim stDocName As String
    Dim appAccess As Access.Application
    Set appAccess = New Access.Application
    appAccess.OpenCurrentDatabase (myPathOfMDB)
    appAccess.DoCmd.OpenReport myReportName, acPreview, , myCriteriaSQLOptional
    appAccess.DoCmd.PrintOut acPrintAll, , , acMedium
    appAccess.Quit
    Set appAccess = Nothing
    If you like more information on how to do what you want check out the forum link below:

    http://www.visualbasicforum.com/f16

    Remember though...there is a process required to do Access Automation on a password protected Database. Go to the link below about this.

    http://support.microsoft.com/defaul...&NoWebContent=1



  5. #5
    Join Date
    Dec 2003
    Location
    Johannesburg, South Africa
    Posts
    18

    Thanks for the Sample

    Hi CyberLynx

    Thanks for the Code, I have tried it but I thing I might need to add a component in VB6, do you perhaps know what it is called?

    I get a User Defefined data type not found.

    Sorry I am still a new commer to VB.

    Thanks
    Divvy

  6. #6
    Join Date
    Nov 2003
    Posts
    1,487
    Go to your menu item Project : References

    Select the Automation units.

    Look it up in MSDN.

  7. #7
    Join Date
    Dec 2003
    Location
    Johannesburg, South Africa
    Posts
    18

    THANKS!

    Thank you!!!

    The Reference is called MICROSOFT ACCESS 9.0 OBJECT LIBRARY for anyone else needing this information.

    Last Question my code (the code you sent), looks as follows

    Dim stDocName As String
    Dim appAccess As Access.Application


    Set appAccess = New Access.Application
    DBName = "C:\BDAY\WHC97.MDB"

    appAccess.OpenCurrentDatabase (DBName)
    appAccess.DoCmd.OpenReport "Rpt Members", acPreview
    appAccess.docmd.PrintOut acPrintAll, , , acMedium
    appAccess.Quit

    Set appAccess = Nothing

    This code produces and error regarding the printing ,do you have a solution?
    ERROR 2212 Micro Soft Access could not print your object

    Lastly, Why does the report not Display within VB? Can I display it?
    Divvy

  8. #8
    Join Date
    Dec 2003
    Location
    Johannesburg, South Africa
    Posts
    18

    WORKING

    Hi Cyberlink

    Don't worry about the error I fixed it. It was a problem with the printer being off line.

    Do need to know what I am doing wrong, or does the report not display.
    Divvy

  9. #9
    Join Date
    Nov 2003
    Posts
    1,487
    No Print Preview in VB. If you can find one where we don't have to hand out a handfull of $$$ then by all means, please let us know.

  10. #10
    Join Date
    Dec 2003
    Location
    Johannesburg, South Africa
    Posts
    18

    Talking VB6

    Cyberlink, If I stumble on this information or invent a solution myself I will give you a copy, promise.

    Thanks for all you help, my ACCESS reporting is working fine.
    Divvy

  11. #11
    Join Date
    Nov 2003
    Posts
    1,487
    I started to work on a Print Preview for VB with a WYSIWYG format but I still have a long way to go with it.
    Glad to here your reports are printing.

Posting Permissions

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