|
-
Mar 21st, 2007, 12:36 PM
#1
Thread Starter
Addicted Member
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
-
Mar 22nd, 2007, 08:06 AM
#2
Thread Starter
Addicted Member
-
Mar 22nd, 2007, 08:15 AM
#3
Hyperactive Member
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...
-
Mar 23rd, 2007, 07:18 AM
#4
Thread Starter
Addicted Member
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
-
Mar 24th, 2007, 12:25 PM
#5
Thread Starter
Addicted Member
Re: print access report
R.
can you help or anyone else?
Thanks a bunch
-
Mar 24th, 2007, 12:54 PM
#6
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|