Results 1 to 6 of 6

Thread: print access report

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    print access report

    Hi gurus.

    Hopefully someone has done this already.

    I have a report on an access DB, the reports takes two arguments ( dates) and they shows the result.

    I want to print this report, it does not have to show or preview anywhere, I want to print the report directly to the printer using VB.net.



    can someone help,please

    Thanks a bunch for any help

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    Re: print access report

    AnyOne?

    please

  3. #3
    Hyperactive Member r0k3t's Avatar
    Join Date
    Dec 2005
    Location
    Cleveland
    Posts
    361

    Re: print access report

    How are you formatting this report? If it is going into a datagrid I have some code that will print it for you - sends it straight to the default printer but it works...

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    Re: print access report

    Thanks R

    No it is not going into a datagrid, I have a report already made in access, it takes two arguments(dates) and I would like to print, send it directly to the printer, no preview,no open, nada, just directly to the default printer, all this from VB

    Thanks a bunch

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    Re: print access report

    R.

    can you help or anyone else?

    Thanks a bunch

  6. #6
    Lively Member
    Join Date
    Mar 2007
    Posts
    115

    Re: print access report

    Ok ... em.. Let me redirect you to the topic I made about this.

    clicky

    Ask RobDog888 if you still don't understand, all credits for this code go to him.

    And here's some code:
    Code:
    Option Explicit On 
    Option Strict On
    Imports Microsoft.Office.Interop
    
    
    Public Class Form1
        Inherits System.Windows.Forms.Form
    
    
    
    #Region " Windows Form Designer generated code "
    
        Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAfdrukken.Click
    
            Dim moApp As Access.Application
            Dim acViewPreview As Access.AcView
    
            Try
                moApp = DirectCast(GetObject(, "Access.Application"), Access.Application)
            Catch ex As Exception
                If TypeName(moApp) = "Nothing" Then
                    moApp = DirectCast(CreateObject("Access.Application"), Access.Application)
                Else
                    MessageBox.Show(ex.Message, "VB/Office Guru™ Access Demo", _
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
                End If
            End Try
    
            moApp.Visible = True
            moApp.OpenCurrentDatabase("C:\Database)
            moApp.RunCommand(Access.AcCommand.acCmdAppMaximize)
            moApp.DoCmd.Maximize()
            moApp.DoCmd.SetWarnings(False)
    
    
            moApp.DoCmd.OpenReport("reportYouNeedToPrint", acViewPreview)
            moApp.CloseCurrentDatabase()
    
        End Sub
    End Class

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