Ok here goes im making a program that calculates the stock of toners we have in our building everything works fine and wen users request the toners it enters there name printer and all there details into a spread sheet. Then i had the idea to make it automaticaly update the number of toners in the build ing instead of manually entering the data.
this is my code:
------------------------------------------------------------
<% OPTION EXPLICIT%>
<!--#include file="common.inc" -->
<%
dim strdepartment
dim strNTUser, iPos, username
dim rsprint, rsprinters
dim strprintername, strNoTonerInHouse, strNoUsedToners
strNTUser = RTrim(Request.ServerVariables("LOGON_USER")
iPos = Len(strNTUser) - InStr(1, strNTUser,"\",1)
strNTUser = Right(strNTUser, iPos)
if strntuser = "GARETH.FINLAY" or strntuser = "Gareth.Finlay" or strntuser = "CHRIS.JOHNSON" or strntuser = "Chris.Johnson" then
strNTUser = Request.form ("UserName"
else
strNTUser = strNTUser
end if
strprintername = request.form ("printername"
strdepartment = request.form ("Department"
Set rsprint = Server.CreateObject("ADODB.Recordset"
strSQL = "SELECT tblrequestedasp.* FROM tblrequestedasp "
rsprint.CursorType = 2
rsprint.LockType = 3
rsprint.Open strSQL, strCon
rsprint.AddNew
rsprint.Fields("name" = strNTuser
rsprint.Fields("Printer" = strprintername
rsprint.Fields("team" = strdepartment
rsprint.Update
rsprint.close
strSQL = "SELECT tprinters.printermake, tprinters.notonersinhouse, tprinters.nounusedtoners "
strSQL = strSQL & "FROM tprinters "
strSQL = strSQL & "WHERE tprinters.printermake =" & "'" & strprintername & "';"
Set rsprinters = Server.CreateObject("ADODB.Recordset"
rsprinters.CursorType = 2
rsprinters.LockType = 3
rsprinters.Open strSQL, strCon
strNoTonersInHouse = rsprinters.Fields("NoTonerInHouse"-1
strNoUsedToners = rsprinters.Fields("NoUnUsedToners"+1
rsprinters.Fields("NoTonerInHouse" = strNoTonerInHouse
rsprinters.Fields("NoUnUsedToners" = strNoUsedToners
rsprinters.Update
rsprinters.close
'response.redirect "logged.asp"
response.write "No Toners - " & strnotonerinhouse
%> <br> <%
response.write "No Used Toners - " & strnousedtoners
%> <br> <%
response.write "Printer Name - " & strprintername
%> <br> <%
%>
------------------------------------------------------------
and this is the error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/toner/PostRequest.asp, line 55
any ideas why it wont work cause im stumped!
this is my code:
------------------------------------------------------------
<% OPTION EXPLICIT%>
<!--#include file="common.inc" -->
<%
dim strdepartment
dim strNTUser, iPos, username
dim rsprint, rsprinters
dim strprintername, strNoTonerInHouse, strNoUsedToners
strNTUser = RTrim(Request.ServerVariables("LOGON_USER")
iPos = Len(strNTUser) - InStr(1, strNTUser,"\",1)
strNTUser = Right(strNTUser, iPos)
if strntuser = "GARETH.FINLAY" or strntuser = "Gareth.Finlay" or strntuser = "CHRIS.JOHNSON" or strntuser = "Chris.Johnson" then
strNTUser = Request.form ("UserName"
else
strNTUser = strNTUser
end if
strprintername = request.form ("printername"
strdepartment = request.form ("Department"
Set rsprint = Server.CreateObject("ADODB.Recordset"
strSQL = "SELECT tblrequestedasp.* FROM tblrequestedasp "
rsprint.CursorType = 2
rsprint.LockType = 3
rsprint.Open strSQL, strCon
rsprint.AddNew
rsprint.Fields("name" = strNTuser
rsprint.Fields("Printer" = strprintername
rsprint.Fields("team" = strdepartment
rsprint.Update
rsprint.close
strSQL = "SELECT tprinters.printermake, tprinters.notonersinhouse, tprinters.nounusedtoners "
strSQL = strSQL & "FROM tprinters "
strSQL = strSQL & "WHERE tprinters.printermake =" & "'" & strprintername & "';"
Set rsprinters = Server.CreateObject("ADODB.Recordset"
rsprinters.CursorType = 2
rsprinters.LockType = 3
rsprinters.Open strSQL, strCon
strNoTonersInHouse = rsprinters.Fields("NoTonerInHouse"-1
strNoUsedToners = rsprinters.Fields("NoUnUsedToners"+1
rsprinters.Fields("NoTonerInHouse" = strNoTonerInHouse
rsprinters.Fields("NoUnUsedToners" = strNoUsedToners
rsprinters.Update
rsprinters.close
'response.redirect "logged.asp"
response.write "No Toners - " & strnotonerinhouse
%> <br> <%
response.write "No Used Toners - " & strnousedtoners
%> <br> <%
response.write "Printer Name - " & strprintername
%> <br> <%
%>
------------------------------------------------------------
and this is the error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/toner/PostRequest.asp, line 55
any ideas why it wont work cause im stumped!