Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Passing a variable to a second page

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-13 : 22:00:05
Mike writes [i]"When I try to hyperlink a table of records to a second page where I inted to privide "More information," I receive the following error



Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/webpub/ex_test/Ex_det.asp, line 45


Line 45 reads as follows:
rs.Open sql, Conn

Apparently there is some parameter that it wants, but I cannot for the life of me figure out what it is. If you could tell me what I am doing wrong, I would really appreciate it.
Mike.

Below is the code from the two pages in their entirety.

----
<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<title>CMWC Future Exercises (Sorted By Fleet)</title>
</head>

<body>

Param = Request.QueryString("Param")
Data = Request.QueryString("Data")

<p align="left">
dim conn
dim RS
dim Session
Dim iRecordToUpdate ' Id of deleted record

set Conn= server.createobject("ADODB.Connection")
Session= "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.Mappath("ex_sched.mdb") & ";"
Conn.ConnectionString = Session
Conn.Open Session

sql = "SELECT Exercise_Data_tbl.EX_Start AS Sorter, Exercise_Data_tbl.Ex_ID, Exercise_Data_tbl.Exercise_Name," & _
" IIf([ex_Start]=[ex_End],Format([ex_Start],'dd mmm yy'),IIf(Month([EX_End])=Month([EX_Start]),Format([EX_Start],'dd')," & _
"Format([EX_Start],'dd mmm')) & ' - ' & Format([EX_End],'dd mmm yy')) AS [Ex Dates], IIf([ipc_Start]=[ipc_End]," & _
"Format([ipc_Start],'dd mmm yy'),IIf(Month([ipc_End])=Month([ipc_Start]),Format([ipc_Start],'dd')," & _
"Format([ipc_Start],'dd mmm')) & ' - ' & Format([ipc_End],'dd mmm yy')) AS [IPC Dates], IIf([mpc_Start]=[Mpc_End]," & _
"Format([mpc_Start],'dd mmm yy'),IIf(Month([mpc_End])=Month([mpc_Start]),Format([mpc_Start],'dd')," & _
"Format([mpc_Start],'dd mmm')) & ' - ' & Format([mpc_End],'dd mmm yy')) AS [MPC Dates]," & _
" IIf([fpc_Start]=[fpc_End],Format([fpc_Start],'dd mmm yy'),IIf(Month([fpc_End])=Month([fpc_Start])," & _
"Format([fpc_Start],'dd'),Format([fpc_Start],'dd mmm')) & ' - ' & Format([fpc_End],'dd mmm yy')) AS [FPC Dates]," & _
" IIf([wcc_Start]=[wcc_End],Format([wcc_Start],'dd mmm yy'),IIf(Month([WCC_End])=Month([WCC_Start])," & _
"Format([WCC_Start],'dd'),Format([WCC_Start],'dd mmm')) & ' - ' & Format([WCC_End],'dd mmm yy')) AS [WCC Dates]," & _
" IIf([MGIT_Start]=[MGIT_End],Format([MGIT_Start],'dd mmm yy'),IIf(Month([MGIT_End])=Month([MGIT_Start])," & _
"Format([MGIT_Start],'dd'),Format([MGIT_Start],'dd mmm')) & ' - ' & Format([MGIT_End],'dd mmm yy')) AS [MGIT Dates],Exercise_Data_tbl.Fleet" & _
" FROM Exercise_Data_tbl ORDER BY Exercise_Data_tbl.EX_Start "

'objRecordset.Open strSQL, session, adOpenKeyset, adLockPessimistic, adCmdText

If cstr(Param) <> "" And cstr(Data) <> "" Then
sql = sql & " And [" & cstr(Param) & "] = " & cstr(Data)
End If
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, 0, 2
</P>

<table border="0" width="750" bgcolor="#FFFFFF">
<TR>
<td width="40"><p align="center"><a
href="http://www.cmwc.navy.smil.mil/" target="_parent"><img
src="../../Cmwc.gif" align="center" border="0"
hspace="12" vspace="23" width="40" height="48"></A></P>
</TD>
<TD><p align="center"><font color="#000000" face="Arial">COMINEWARCOM
Exercise Schedule

</font><font color="#000000" size="1" face="Arial">(Only
Future Exercises Are Shown)
</font><font
color="#000000" face="Arial"> </font></P>
</TD>
</TR>
</TABLE>

<table border="1" cellpadding="0" cellspacing="0" width="7
   

- Advertisement -