Hi,
I have the following code in one of my Intranet pages. It is used to allow workers to be able to see customer signatures through a web page. My problem is that the line Set fso = CreateObject("Scripting.FileSystemObject") keeps resulting in the error ActiveX component can't create object: 'Scripting.FileSystemObject'
I can't understand it though as before this line I have a createobject for the database connection and this works fine. I am not trying to write to a file so I don't think permissions are a problem either. Please can anybody help though as it is making me mad now.
<SCRIPT LANGUAGE=VBScript>
sub ValidKeyPress()
if window.event.keycode < 48 or window.event.keycode > 57 then
window.event.returnvalue = false
msgbox "The value must be numeric",,"Shepshed"
end if
end sub
sub Search()
if frmSearch.txtCriteria.value = "" then
msgbox "Please enter a criteria before searching.",,""
frmSearch.txtCriteria.focus
exit sub
end if
if frmSearch.R1(2).checked = true AND len(frmSearch.txtCriteria.value) <> 9 then
msgbox "Please enter a correct Mantis account number.",,"Shepshed"
frmSearch.txtCriteria.focus
exit sub
end if
dim dbpath
dim ipath
dim conn1
dim rs1
dim result
dim fso
dbpath = "db1.mdb"
set conn1 = CreateObject("ADODB.Connection")
conn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath
conn1.Open
if frmSearch.R1(0).checked = true then
set rs1 = conn1.Execute("SELECT * FROM Customers WHERE NFMLCustomerNo=" & FrmSearch.txtCriteria.value)
end if
if frmSearch.R1(1).checked = true then
set rs1 = conn1.Execute("SELECT * FROM Customers WHERE MantisCustomerNo=" & FrmSearch.txtCriteria.value)
end if
if frmSearch.R1(2).checked = true then
set rs1 = conn1.Execute("SELECT * FROM Customers WHERE MantisCustomerNo=" & FrmSearch.txtCriteria.value)
end if
if rs1.eof = false then
result = rs1("MantisCustomerNo")
'ipath = "file:///X:\Bmp\Bmp\Signature\" & result & ".jpg"
ipath = "file://Ssbs/2001/Bmp/Signature/" & result & ".jpg"
set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists(ipath) then
NewTableHTML = "<img border=" +chr(34)+ "0" +chr(34)+ " src="+chr(34)+ ipath +chr(34)+ " width=" +chr(34)+ "278" +chr(34)+ " height=" +chr(34)+ "107" +chr(34)+">"
document.all.myTableLocation.innerHTML=NewTableHTML
else
NewTableHTML = "No Signature file found for this customer."
document.all.myTableLocation.innerHTML=NewTableHTML
end if
end if
end sub
sub setclearall
document.all.myTableLocation.innerHTML=""
frmSearch.txtCriteria.value = ""
frmSearch.R1(0).checked = true
end sub
Sub SubmitForm
frmSearch.submit
End Sub
</SCRIPT>
I have the following code in one of my Intranet pages. It is used to allow workers to be able to see customer signatures through a web page. My problem is that the line Set fso = CreateObject("Scripting.FileSystemObject") keeps resulting in the error ActiveX component can't create object: 'Scripting.FileSystemObject'
I can't understand it though as before this line I have a createobject for the database connection and this works fine. I am not trying to write to a file so I don't think permissions are a problem either. Please can anybody help though as it is making me mad now.
<SCRIPT LANGUAGE=VBScript>
sub ValidKeyPress()
if window.event.keycode < 48 or window.event.keycode > 57 then
window.event.returnvalue = false
msgbox "The value must be numeric",,"Shepshed"
end if
end sub
sub Search()
if frmSearch.txtCriteria.value = "" then
msgbox "Please enter a criteria before searching.",,""
frmSearch.txtCriteria.focus
exit sub
end if
if frmSearch.R1(2).checked = true AND len(frmSearch.txtCriteria.value) <> 9 then
msgbox "Please enter a correct Mantis account number.",,"Shepshed"
frmSearch.txtCriteria.focus
exit sub
end if
dim dbpath
dim ipath
dim conn1
dim rs1
dim result
dim fso
dbpath = "db1.mdb"
set conn1 = CreateObject("ADODB.Connection")
conn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath
conn1.Open
if frmSearch.R1(0).checked = true then
set rs1 = conn1.Execute("SELECT * FROM Customers WHERE NFMLCustomerNo=" & FrmSearch.txtCriteria.value)
end if
if frmSearch.R1(1).checked = true then
set rs1 = conn1.Execute("SELECT * FROM Customers WHERE MantisCustomerNo=" & FrmSearch.txtCriteria.value)
end if
if frmSearch.R1(2).checked = true then
set rs1 = conn1.Execute("SELECT * FROM Customers WHERE MantisCustomerNo=" & FrmSearch.txtCriteria.value)
end if
if rs1.eof = false then
result = rs1("MantisCustomerNo")
'ipath = "file:///X:\Bmp\Bmp\Signature\" & result & ".jpg"
ipath = "file://Ssbs/2001/Bmp/Signature/" & result & ".jpg"
set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists(ipath) then
NewTableHTML = "<img border=" +chr(34)+ "0" +chr(34)+ " src="+chr(34)+ ipath +chr(34)+ " width=" +chr(34)+ "278" +chr(34)+ " height=" +chr(34)+ "107" +chr(34)+">"
document.all.myTableLocation.innerHTML=NewTableHTML
else
NewTableHTML = "No Signature file found for this customer."
document.all.myTableLocation.innerHTML=NewTableHTML
end if
end if
end sub
sub setclearall
document.all.myTableLocation.innerHTML=""
frmSearch.txtCriteria.value = ""
frmSearch.R1(0).checked = true
end sub
Sub SubmitForm
frmSearch.submit
End Sub
</SCRIPT>