asp_databases thread: Client script uses Access database requires mapped network drive
I have written an html page that runs on a client and pulls information
from an Access Database into an Excel spreadsheet. It works just fine if
the client has a network drive mapped to the web server (my database is on
the web server). If there is no mapped drive, I get the message that I am
not authorized to access the database.
Do anyone know how I can get around this?
Here is how I'm coding the connection and recordset:
<!--
Dim xlObj
Dim cnGoalsDBCon
dim rsGoals
Dim strConnectString
Dim strSelectGoals
Dim strDateRange
Dim intRow
'Establish connection to the Goals database
set cnGoalsDBCon = createobject("adodb.connection")
strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=//gofinweb/famisdata/productivity_goals.mdb;Persist Security
Info=False;User ID=Admin;Password=;"
cnGoalsDBCon.Open strConnectstring,finance,fedex
'Create Goals recordset
set rsGoals = createobject("adodb.recordset")
Sub btnExcel_onclick
if FORM1.txtStartDate.value = "" then
FORM1.txtStartDate.value = formatdatetime (date (),2)
end if
if FORM1.txtEndDate.value = "" then
FORM1.txtEndDate.value = FORM1.txtStartDate.value
end if
strDateRange = "Period between #" & FORM1.txtStartDate.value & "#
and #" & FORM1.txtEndDate.value & "#"
strSelectGoals = "select * from goals where ((entsysid like "
& """" & selLocation.getValue() & "%" & """" & ") and (" & strDateRange
& ")) order by entsysid, period"
with rsGoals
.Source = strSelectGoals
.ActiveConnection = cnLocdbCon
.LockType = 1 'Read Only
.CursorType = 0 'Forward
.Open
end with
if rsGoals.RecordCount < 1 then
msgbox "No data was found that met your criteria. Please change
and resubmit."
exit sub
end if
set xlObj = createobject("excel.application")
xlObj.workbooks.add
xlObj.visible = true
intRow = 1
xlObj.cells(intRow,1).value = "Entsysid"
xlObj.cells(intRow,2).value = "Cost Center"
xlObj.cells(intRow,3).value = "Month"
xlObj.cells(intRow,4).value = "Fixed FTE"
xlObj.cells(intRow,5).value = "Var FTE"
xlObj.cells(intRow,6).value = "IB Vol"
xlObj.cells(intRow,7).value = "OB Vol"
rsGoals.MoveFirst
Do until rsGoals.EOF
intRow = intRow + 1
xlObj.cells(intRow,1).value = rsGoals("Entsysid")
xlObj.cells(intRow,2).value = rsGoals("CostCenter")
xlObj.cells(intRow,3).value = rsGoals("Period")
xlObj.cells(intRow,3).numberformat = "m/d/y"
xlObj.cells(intRow,4).value = rsGoals("FixedFTE")
xlObj.cells(intRow,5).value = rsGoals("VariableFTE")
xlObj.cells(intRow,6).value = rsGoals("InboundVol")
xlObj.cells(intRow,7).value = rsGoals("OutboundVol")
rsGoals.MoveNext
Loop
rsGoals.Close
End Sub
-->
Thanks for any help you can give.
John Tilmon