E
eli silverman
I am upgrading an existing application from Access 2000 to VB6. To get people
up and running as quickly as possible I want to have my VB App call the
reports in my ADP. Eventually they will all be converted to Crystal.
I am using the following code
Public Sub PrintAccessRpt(strReportName As String, vntParam As Variant,
INPUTPARAM As String, blnPreview As Integer)
Dim strdbname As String
Dim objAccess As Object
Dim lngErrNum As Long
On Error GoTo PrintAccessReport_ErrHandler
Screen.MousePointer = vbHourglass
Set objAccess = Nothing
Set objAccess = GetObject("C:\reports.adp", "Access.Application.9")
With objAccess
If INPUTPARAM <> "" Then 'applies input parameters if used on the
form design
.DoCmd.openreport strReportName, acviewdesign
.reports(strReportName).inputparameters = INPUTPARAM
End If
If blnPreview Then
.DoCmd.openreport strReportName, acviewpreview, , vntParam
.DoCmd.Maximize
.Visible = True
Else
.DoCmd.openreport strReportName, acviewnormal, , vntParam
DoEvents
Set objAccess = Nothing
End If
End With
Screen.MousePointer = vbDefault
Exit Sub
Everything works fine untill the actual openreport command, then I gat the
message that the datasource does not exist.
If I step past the message and make access visible I see that the project is
disconnected.
I have tried using .CurrentProject.OpenConnection connstr, login, pwd to
establish the connection but I get an automation error.
How can I aotomate the logon so that the adp is not disconnected?
Any help would be greatly appreciated.
p.s. the orriginal app is access 2000 I have 2000 and 2003 on my system
Thanks in advance
up and running as quickly as possible I want to have my VB App call the
reports in my ADP. Eventually they will all be converted to Crystal.
I am using the following code
Public Sub PrintAccessRpt(strReportName As String, vntParam As Variant,
INPUTPARAM As String, blnPreview As Integer)
Dim strdbname As String
Dim objAccess As Object
Dim lngErrNum As Long
On Error GoTo PrintAccessReport_ErrHandler
Screen.MousePointer = vbHourglass
Set objAccess = Nothing
Set objAccess = GetObject("C:\reports.adp", "Access.Application.9")
With objAccess
If INPUTPARAM <> "" Then 'applies input parameters if used on the
form design
.DoCmd.openreport strReportName, acviewdesign
.reports(strReportName).inputparameters = INPUTPARAM
End If
If blnPreview Then
.DoCmd.openreport strReportName, acviewpreview, , vntParam
.DoCmd.Maximize
.Visible = True
Else
.DoCmd.openreport strReportName, acviewnormal, , vntParam
DoEvents
Set objAccess = Nothing
End If
End With
Screen.MousePointer = vbDefault
Exit Sub
Everything works fine untill the actual openreport command, then I gat the
message that the datasource does not exist.
If I step past the message and make access visible I see that the project is
disconnected.
I have tried using .CurrentProject.OpenConnection connstr, login, pwd to
establish the connection but I get an automation error.
How can I aotomate the logon so that the adp is not disconnected?
Any help would be greatly appreciated.
p.s. the orriginal app is access 2000 I have 2000 and 2003 on my system
Thanks in advance