G
Guest
Everything works fine untill I try to use a where clause, then I get this
error: There was a problem accessing a property or method of the OLE object.
System.Runtime.InteropServices.COMException: There was a problem accessing a
property or method of the OLE object.
Here's my code, I can't find anything wrong.
Public Function fGetSnapshot(ByVal sReportName As String)
Dim acApp As Access.Application
Dim myReport As Access.Report
Dim strDBPath As String
Dim StrFileName As String
Dim StrFilePath As String
Dim strSQL As String
Dim strFilter As String
Const acFormatSNP = "Snapshot Format (*.snp)"
Dim sUserName As String
Dim fso
fso = CreateObject("Scripting.FileSystemObject")
strDBPath = Server.MapPath("..\YMSReports\DB\UltraReporting_SQL.adp")
StrFilePath = Server.MapPath("..\YMSReports\DB\")
sUserName = Session("username")
acApp = New Access.Application
With acApp
.OpenCurrentDatabase(strDBPath)
strFilter = ""
' Print the report.
strSQL = "[tblYardOnly].[YARD_PO_UserField2] = " &
cboDiv.SelectedValue
With acApp.DoCmd
If Len(strSQL) > 0 Then
.OpenReport(sReportName, Access.AcView.acViewPreview, ,
strSQL)
Else
.OpenReport(sReportName, Access.AcView.acViewPreview)
End If
End With
'.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, ,
strSQL)
StrFileName = Mid(sUserName, 1, InStr(1, sUserName, "@",
CompareMethod.Text) - 1) & sReportName & ".snp"
'if it is already there, delete it
.DoCmd.OutputTo(Access.AcOutputObjectType.acOutputReport, ,
acFormatSNP, StrFilePath & StrFileName)
End With
acApp.Quit()
acApp = Nothing
Response.Redirect(StrFilePath & StrFileName, False)
End Function
Thanks
error: There was a problem accessing a property or method of the OLE object.
System.Runtime.InteropServices.COMException: There was a problem accessing a
property or method of the OLE object.
Here's my code, I can't find anything wrong.
Public Function fGetSnapshot(ByVal sReportName As String)
Dim acApp As Access.Application
Dim myReport As Access.Report
Dim strDBPath As String
Dim StrFileName As String
Dim StrFilePath As String
Dim strSQL As String
Dim strFilter As String
Const acFormatSNP = "Snapshot Format (*.snp)"
Dim sUserName As String
Dim fso
fso = CreateObject("Scripting.FileSystemObject")
strDBPath = Server.MapPath("..\YMSReports\DB\UltraReporting_SQL.adp")
StrFilePath = Server.MapPath("..\YMSReports\DB\")
sUserName = Session("username")
acApp = New Access.Application
With acApp
.OpenCurrentDatabase(strDBPath)
strFilter = ""
' Print the report.
strSQL = "[tblYardOnly].[YARD_PO_UserField2] = " &
cboDiv.SelectedValue
With acApp.DoCmd
If Len(strSQL) > 0 Then
.OpenReport(sReportName, Access.AcView.acViewPreview, ,
strSQL)
Else
.OpenReport(sReportName, Access.AcView.acViewPreview)
End If
End With
'.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, ,
strSQL)
StrFileName = Mid(sUserName, 1, InStr(1, sUserName, "@",
CompareMethod.Text) - 1) & sReportName & ".snp"
'if it is already there, delete it
.DoCmd.OutputTo(Access.AcOutputObjectType.acOutputReport, ,
acFormatSNP, StrFilePath & StrFileName)
End With
acApp.Quit()
acApp = Nothing
Response.Redirect(StrFilePath & StrFileName, False)
End Function
Thanks