Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Colombo
RidhMathraa ’26 🎶✨
Tmadhusanka
Updated:
Yesterday at 11:58 PM
Ad icon
Colombo
PXN V10 Pro Direct Drive Racing Wheel (Under Warranty)
Abdur Rahman
Updated:
Yesterday at 10:23 PM
Ad icon
USDT ණය සේවාව - USDT Loan Service
පුරවැසියා
Updated:
Yesterday at 4:54 PM
Ad icon
🎮 INDIAN PSN GIFT CARDS AVAILABLE NOW! 🎮
madukaperera
Updated:
Tuesday at 12:57 PM
🚀 Google AI PRO – 18 Months | Rs. 850 Only
lkkolla
Updated:
Monday at 4:56 PM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
Acess Reports In VB6
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="R_L" data-source="post: 3673724" data-attributes="member: 16427"><p>try this man</p><p></p><p>This code enables you to specify a Microsoft Access database open a report and print it out or open in preview form through Visual Basic.</p><p></p><p>Create a module and place the following inside: </p><p></p><p>Code:</p><p></p><p>Option Explicit</p><p></p><p> ' In other applications like Microsoft Visual Basic,</p><p></p><p> ' you can include a reference to Microsoft Access to</p><p></p><p> ' gain the use of Access constants. Or, use the following</p><p></p><p> ' constant values...</p><p></p><p> Global Const acNormal = 0</p><p></p><p> Global Const acDesign = 1</p><p></p><p> Global Const acPreview = 2</p><p></p><p> ' -----------------------------------------------------</p><p></p><p> ' Application Quit options...</p><p></p><p> ' saves all objects without displaying a dialog box:</p><p></p><p> Global Const acSaveYes = 0</p><p></p><p> ' displays a dialog box that asks whether you want to save any</p><p></p><p> ' database objects that have been changed but not saved:</p><p></p><p> Global Const acPrompt = 1</p><p></p><p> ' quits Microsoft Access without saving any objects:</p><p></p><p> Global Const acExit = 2</p><p></p><p> Sub PrintAccessReport(dbname As String, rptname As String, preview As Boolean)</p><p></p><p> Dim objaccess As Object</p><p></p><p> On Error GoTo PrintAccessReport_ErrHandler</p><p></p><p> Set objaccess = CreateObject("<span style="color: Red">Access.Application</span>")</p><p></p><p> With objaccess</p><p></p><p> .OpenCurrentDatabase filepath:=dbname</p><p></p><p> If preview = True Then 'Preview report on screen.</p><p></p><p> .DoCmd.OpenReport reportname:=<span style="color: Red">rptname</span>, View:=acPreview</p><p></p><p> .Visible = True</p><p></p><p> .DoCmd.Maximize 'maximizes the Report window</p><p></p><p> .DoCmd.Maximize 'maximizes Access window</p><p></p><p> Else 'Print report to printer.</p><p></p><p> .DoCmd.OpenReport reportname:=rptname, View:=acNormal</p><p></p><p> DoEvents 'Allow report to be sent to printer.</p><p></p><p> End If</p><p></p><p> End With</p><p></p><p> Set objaccess = Nothing</p><p></p><p> Exit Sub</p><p></p><p> PrintAccessReport_ErrHandler:</p><p></p><p> MsgBox Error$(), , "Print Access Report"</p><p></p><p> End Sub</p><p></p><p></p><p>Now Call this procedure with a command button or whatever replacing the example below with the desired parameters. The first parameter requests the path to the database, the second requests the Report name, and the third requests the view state: True will open access and display the report, False will just print the report.</p><p></p><p>Code:</p><p>Call PrintAccessReport App.Path & "collectables.mdb", "Figures", True</p></blockquote><p></p>
[QUOTE="R_L, post: 3673724, member: 16427"] try this man This code enables you to specify a Microsoft Access database open a report and print it out or open in preview form through Visual Basic. Create a module and place the following inside: Code: Option Explicit ' In other applications like Microsoft Visual Basic, ' you can include a reference to Microsoft Access to ' gain the use of Access constants. Or, use the following ' constant values... Global Const acNormal = 0 Global Const acDesign = 1 Global Const acPreview = 2 ' ----------------------------------------------------- ' Application Quit options... ' saves all objects without displaying a dialog box: Global Const acSaveYes = 0 ' displays a dialog box that asks whether you want to save any ' database objects that have been changed but not saved: Global Const acPrompt = 1 ' quits Microsoft Access without saving any objects: Global Const acExit = 2 Sub PrintAccessReport(dbname As String, rptname As String, preview As Boolean) Dim objaccess As Object On Error GoTo PrintAccessReport_ErrHandler Set objaccess = CreateObject("[COLOR="Red"]Access.Application[/COLOR]") With objaccess .OpenCurrentDatabase filepath:=dbname If preview = True Then 'Preview report on screen. .DoCmd.OpenReport reportname:=[COLOR="Red"]rptname[/COLOR], View:=acPreview .Visible = True .DoCmd.Maximize 'maximizes the Report window .DoCmd.Maximize 'maximizes Access window Else 'Print report to printer. .DoCmd.OpenReport reportname:=rptname, View:=acNormal DoEvents 'Allow report to be sent to printer. End If End With Set objaccess = Nothing Exit Sub PrintAccessReport_ErrHandler: MsgBox Error$(), , "Print Access Report" End Sub Now Call this procedure with a command button or whatever replacing the example below with the desired parameters. The first parameter requests the path to the database, the second requests the Report name, and the third requests the view state: True will open access and display the report, False will just print the report. Code: Call PrintAccessReport App.Path & "collectables.mdb", "Figures", True [/QUOTE]
Insert quotes…
Verification
Asuwa dahayen wadi kalama keeyada?
Post reply
Top
Bottom