For some odd reason I keep getting the following err msg:
Error Type:
MSAccess (0x800A1EBA)
Microsoft Access can't open the database because it is missing, or opened exclusively by another user.
On line 57 which is:
objAccess.OpenCurrentDatabase strDbName
I have strDBName set as
strDbName = "C:\Test.mdb"
This is the correct name and the db is not opened I keep getting this err msg.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Option Explicit
%>
<%
'Various Constants
const acNormal= "0" 'Print report
const acDesign = "1" 'open report in design (n/a in runtime)
Const acPreview = "2" 'open in preview window...probably not a good idea
const acSaveYes = "0" 'saves all objects w/out displaying dialog
const acPrompt = "1" 'prompts user --> definately a not a good thing!
const acQuitSaveNone = "2" 'exists without saving
const acViewPreview = "2" 'Print Preview
const acOutputReport = "3" 'Output the report in Snapshot format
'================================================= ================
'this will retrieve the report and display it.
'================================================= ================
Dim strDbName, strRptName, strWhere
Dim strSnapFileAb, strSnapFileRe, strFilter
' the above vars are used with the Access objects
Dim objAccess 'This is our MSAccess object
'-----------------------------------------------------------------
' Here we get a file name.
'-----------------------------------------------------------------
'Absolute path to desired Snapfile location
strSnapFileAb = "C:\test.snp"
'Relative path to desired Snapfile location
strSnapFileRe = "../db/snapfiles/test.snp"
'-----------------------------------------------------------------
'Now we get the data we need from the submitted Form
'-----------------------------------------------------------------
strDbName = "C:\Test.mdb"
strRptName = "rptSummary"
strWhere = ""
'strWhere = "po_SAP_num = 5100000240"
strFilter = ""
'-----------------------------------------------------------------
' Create an instance of access. Visible is set to false b/c
' this is running as a proccess, not as a desktop application
'-----------------------------------------------------------------
Set objAccess = Server.CreateObject("Access.Application")
objAccess.Visible = False
'-----------------------------------------------------------------
' Open the database, then the Report, and output it in Snapshot format
'-----------------------------------------------------------------
objAccess.OpenCurrentDatabase strDbName
With objAccess.DoCmd
' open in preview mode so that we can pass a where clause
' if neccesary
.OpenReport strRptName, acViewPreview, strFilter, strWhere
' now you can save the report to snapshot format
' Server.MapPath gets the current directory.
.OutputTo acOutputReport, "test", "Snapshot Format", strSnapFileAb
.Close
End With
' Clean Up
objAccess.Quit acQuitSaveNone 'acQuitSaveNone
Set objAccess = Nothing
'-----------------------------------------------------------------
'Now for the HTML, with the ActiveX plugin
'-----------------------------------------------------------------
If strSnapFileRe <> "" Then%>
<OBJECT ID="SnapshotViewer1" WIDTH=750 HEIGHT=500 CODEBASE="Snapview.ocx" CLASSID="CLSID:F0E42D60-368C-11D0-AD81-00A0C90DC8D9" VIEWASTEXT>
<PARAM NAME="_Version" VALUE="65536">
<PARAM NAME="SnapshotPath" VALUE="<%=strSnapFileRe%>">
<PARAM NAME="Zoom" VALUE="0">
<PARAM NAME="AllowContextMenu" VALUE="-1">
<PARAM NAME="ShowNavigationButtons" VALUE="-1">
</OBJECT>
<%
Else
Response.Write("<P><B>An error occured while " & _
"attempting to produce your report.</B></P>")
End If
%>
Error Type:
MSAccess (0x800A1EBA)
Microsoft Access can't open the database because it is missing, or opened exclusively by another user.
On line 57 which is:
objAccess.OpenCurrentDatabase strDbName
I have strDBName set as
strDbName = "C:\Test.mdb"
This is the correct name and the db is not opened I keep getting this err msg.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Option Explicit
%>
<%
'Various Constants
const acNormal= "0" 'Print report
const acDesign = "1" 'open report in design (n/a in runtime)
Const acPreview = "2" 'open in preview window...probably not a good idea
const acSaveYes = "0" 'saves all objects w/out displaying dialog
const acPrompt = "1" 'prompts user --> definately a not a good thing!
const acQuitSaveNone = "2" 'exists without saving
const acViewPreview = "2" 'Print Preview
const acOutputReport = "3" 'Output the report in Snapshot format
'================================================= ================
'this will retrieve the report and display it.
'================================================= ================
Dim strDbName, strRptName, strWhere
Dim strSnapFileAb, strSnapFileRe, strFilter
' the above vars are used with the Access objects
Dim objAccess 'This is our MSAccess object
'-----------------------------------------------------------------
' Here we get a file name.
'-----------------------------------------------------------------
'Absolute path to desired Snapfile location
strSnapFileAb = "C:\test.snp"
'Relative path to desired Snapfile location
strSnapFileRe = "../db/snapfiles/test.snp"
'-----------------------------------------------------------------
'Now we get the data we need from the submitted Form
'-----------------------------------------------------------------
strDbName = "C:\Test.mdb"
strRptName = "rptSummary"
strWhere = ""
'strWhere = "po_SAP_num = 5100000240"
strFilter = ""
'-----------------------------------------------------------------
' Create an instance of access. Visible is set to false b/c
' this is running as a proccess, not as a desktop application
'-----------------------------------------------------------------
Set objAccess = Server.CreateObject("Access.Application")
objAccess.Visible = False
'-----------------------------------------------------------------
' Open the database, then the Report, and output it in Snapshot format
'-----------------------------------------------------------------
objAccess.OpenCurrentDatabase strDbName
With objAccess.DoCmd
' open in preview mode so that we can pass a where clause
' if neccesary
.OpenReport strRptName, acViewPreview, strFilter, strWhere
' now you can save the report to snapshot format
' Server.MapPath gets the current directory.
.OutputTo acOutputReport, "test", "Snapshot Format", strSnapFileAb
.Close
End With
' Clean Up
objAccess.Quit acQuitSaveNone 'acQuitSaveNone
Set objAccess = Nothing
'-----------------------------------------------------------------
'Now for the HTML, with the ActiveX plugin
'-----------------------------------------------------------------
If strSnapFileRe <> "" Then%>
<OBJECT ID="SnapshotViewer1" WIDTH=750 HEIGHT=500 CODEBASE="Snapview.ocx" CLASSID="CLSID:F0E42D60-368C-11D0-AD81-00A0C90DC8D9" VIEWASTEXT>
<PARAM NAME="_Version" VALUE="65536">
<PARAM NAME="SnapshotPath" VALUE="<%=strSnapFileRe%>">
<PARAM NAME="Zoom" VALUE="0">
<PARAM NAME="AllowContextMenu" VALUE="-1">
<PARAM NAME="ShowNavigationButtons" VALUE="-1">
</OBJECT>
<%
Else
Response.Write("<P><B>An error occured while " & _
"attempting to produce your report.</B></P>")
End If
%>