Click here to Skip to main content
15,920,708 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: MDI problem Pin
Anonymous20-Jan-04 22:18
Anonymous20-Jan-04 22:18 
GeneralLocking files in VB6 Pin
steff kamush19-Jan-04 23:48
steff kamush19-Jan-04 23:48 
GeneralRe: Locking files in VB6 Pin
Dave Kreskowiak20-Jan-04 8:08
mveDave Kreskowiak20-Jan-04 8:08 
GeneralRe: Locking files in VB6 Pin
steff kamush20-Jan-04 21:31
steff kamush20-Jan-04 21:31 
GeneralRe: Locking files in VB6 Pin
Dave Kreskowiak21-Jan-04 6:40
mveDave Kreskowiak21-Jan-04 6:40 
Generalstill chart Pin
Adhizzz19-Jan-04 21:20
Adhizzz19-Jan-04 21:20 
GeneralRe: still chart Pin
steff kamush20-Jan-04 6:55
steff kamush20-Jan-04 6:55 
GeneralRe: still chart Pin
steff kamush20-Jan-04 6:56
steff kamush20-Jan-04 6:56 
hi Adhizzz. i hope this helps

Print a Microsoft Access report from VB 6.0

As you may know, Microsoft Access provides a much more robust reporting
system than Visual Basic. As a result, if you use Access as a back-end
to your application, you may want to print Access reports from your VB
application. Fortunately, you can do just that with Automation.

The following code shows one way to do so, using late binding. remember to replace dbName and rptName with correct values:

Dim objAccess As Object

Private Sub Command1_Click()
Dim dbName As String
Dim rptName As String
Dim Preview As Long
Const acNormal = 0
Const acPreview = 2

dbName = "D:\PathToDB\db1.mdb"
rptName = "MyReportName"
Preview = acPreview 'acNormal

With objAccess
.OpenCurrentDatabase filepath:=dbName
If Preview = acPreview Then
.Visible = True
.DoCmd.OpenReport rptName, Preview
Else
.DoCmd.OpenReport rptName
End If
End With
End Sub

Private Sub Form_Load()
Set objAccess = CreateObject("Access.Application")
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
objAccess.Quit
On Error GoTo 0
Set objAccess = Nothing
End Sub


Rose | [Rose] Rose | [Rose]
QuestionWhere to Start??? Pin
SweetoSyed19-Jan-04 16:39
SweetoSyed19-Jan-04 16:39 
AnswerRe: Where to Start??? Pin
gpa200020-Jan-04 21:28
gpa200020-Jan-04 21:28 
GeneralRe: Where to Start??? Pin
HinJinShah22-Jan-04 6:23
HinJinShah22-Jan-04 6:23 
GeneralPls help me!! Pin
Member 82457919-Jan-04 15:19
Member 82457919-Jan-04 15:19 
GeneralRe: Pls help me!! Pin
gpa200020-Jan-04 21:32
gpa200020-Jan-04 21:32 
GeneralDeploy VBA script for Outlook Pin
staft19-Jan-04 14:54
staft19-Jan-04 14:54 
GeneralHELP ME PLEASE Pin
RobertAdam8218-Jan-04 8:24
RobertAdam8218-Jan-04 8:24 
GeneralRe: HELP ME PLEASE Pin
Dave Kreskowiak18-Jan-04 9:01
mveDave Kreskowiak18-Jan-04 9:01 
GeneralRe: HELP ME PLEASE Pin
RobertAdam8218-Jan-04 11:35
RobertAdam8218-Jan-04 11:35 
Generaldata connectivecty with coding Pin
Anonymous18-Jan-04 6:27
Anonymous18-Jan-04 6:27 
GeneralRe: data connectivecty with coding Pin
Guillermo Rivero18-Jan-04 7:03
Guillermo Rivero18-Jan-04 7:03 
GeneralRe: data connectivecty with coding Pin
gpa200020-Jan-04 21:46
gpa200020-Jan-04 21:46 
Questionhow to open Main,Mid,Child Form? Pin
samerali18-Jan-04 3:54
samerali18-Jan-04 3:54 
AnswerRe: how to open Main,Mid,Child Form? Pin
steff kamush20-Jan-04 6:38
steff kamush20-Jan-04 6:38 
GeneralFirewall Pin
RobertAdam8217-Jan-04 21:04
RobertAdam8217-Jan-04 21:04 
GeneralTelnet Character & cursor attributes Pin
Syed Nadeemulla Hussaini17-Jan-04 20:36
Syed Nadeemulla Hussaini17-Jan-04 20:36 
GeneralLeague Table - its an emergency plz help Pin
andy009278617-Jan-04 6:48
andy009278617-Jan-04 6:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.