|
-
Aug 1st, 2004, 01:49 PM
#1
Thread Starter
New Member
Access Report
can we use Aceess Report in VB6 Application if yes then How
-
Aug 3rd, 2004, 12:06 AM
#2
VB Code:
Option Explicit
'ADD REFERENCE TO MS ACCESS XX.X OBJECT LIBRARY
'ADD ONE (1) COMMAND BUTTON (Command1)
'EXAMPLE WILL CREATE A NEW DATABASE AND A NEW REPORT WITH ONE TEXTBOX AND A LINKED LABEL
Private Sub Command1_Click()
Dim oApp As Access.Application
Dim oReport As Access.Report
Dim oLabel As Object
Dim oTextBox As Object
If Dir("D:\RobDog888.mdb", vbArchive Or vbNormal Or vbHidden Or vbReadOnly) <> "" Then
Kill "D:\RobDog888.mdb"
End If
Set oApp = New Access.Application
oApp.NewCurrentDatabase "D:\RobDog888.mdb"
oApp.Visible = True
Set oReport = oApp.CreateReport
' oReport.RecordSource = "qrySomeQuery"
oReport.LayoutForPrint = True
oReport.Caption = "MyReport"
Set oTextBox = oApp.CreateReportControl(oReport.Name, acTextBox, acDetail, "", "", 1560, 1500, 1000, 250)
Set oLabel = oApp.CreateReportControl(oReport.Name, acLabel, acDetail, oTextBox.Name, , 500, 1500, 1000, 250)
oTextBox.Properties(1).Value = "txtTextBox"
oTextBox.Properties(3).Value = "My Text"
oLabel.Name = "lblLabel"
oLabel.Caption = "My Label"
DoCmd.Maximize
oApp.RunCommand acCmdPrintPreview
'oReport.Print
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 2nd, 2005, 10:41 AM
#3
Junior Member
Re: Access Report
Is there any code that will do the same in VB.NET. also the statement
Dim oApp As Access.Application gives me an error stating that it is not defined and i have not idea whats wrong
Thank you
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
|