Results 1 to 4 of 4

Thread: MS Access Report

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    KC
    Posts
    72
    I have some reports saved in an Access Database, and I need VB to print them. How do I get my VB app to find these reports and print or preview them?

  2. #2
    Guest

    Thumbs up Ok still testing code, but this is what i got

    Make a reference to MS Access in the project.

    Add the following code
    '
    ' Setup reference to Access
    '
    Dim MSAcc As Access.Application
    Set MSAcc = New Access.Application
    '
    ' ok connect your database
    '
    MSAcc.OpenCurrentDatabase("c:\whatever.mdb")
    ' by default, the OpenReport method of the
    ' DoCmd object will send the report to the printer
    '
    MSAcc.DoCmd.OpenReport "MyReport"
    ' close the database

    MSAcc.CloseCurrentDatabase

    Still mucking around with this, but hope it gives you a guideline
    That's about all it takes. Just remember

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    KC
    Posts
    72

    Talking

    Thanks, I can get that to do what I need. I also found that if I changed the OpenReport line to:

    MSAcc.DoCmd.OpenReport "MyReport", 2

    It will open in preview mode.

  4. #4
    Guest

    Thumbs up Cool delker didn't know that

    Still playing with the code to keep our end user happy so will include your code with maybe a tick box or something to allow mode selection.

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