This seems like it should be easy but I am stumped. I am trying take
a variable, add to it, and insert the result as a new record into
Access.
The ending result is:
INSERT INTO Period (CoID, CkDate) Values 1, #2007/01/26#)
My code is Dim RecID
Dim Conn
Dim sDate, eDate, ckDate
Dim tSQL
RecID=ccdlookup ("PeriodID","Ma xPeriod","CoID= " &
request.Cookies ("myco"), DBaccesspayroll )
ckDate=ccdlooku p("CkDate","Per iod","PerID=" & RecID,dbaccessp ayroll)
ckDate=ccformat date(DateAdd("d ",AddPayroll.Ra dioButton1.valu e,ckDate),Array ("yyyy",
"/", "mm", "/", "dd"))
tSQL = "INSERT INTO Period (CoID, CkDate)" & " Values "&
request.Cookies ("myco") & ", #" & ckDate &"#)"
response.Write tSQL
Response.end
Set conn = new clsdbaccesspayr oll
conn.execute(tS QL)
'conn.close
'End Custom Code
The error message I am getting is:
ADODB.Recordset error '800a0e7d'
The connection cannot be used to perform this operation. It is either
closed or invalid in this context.
Any ideas?
a variable, add to it, and insert the result as a new record into
Access.
The ending result is:
INSERT INTO Period (CoID, CkDate) Values 1, #2007/01/26#)
My code is Dim RecID
Dim Conn
Dim sDate, eDate, ckDate
Dim tSQL
RecID=ccdlookup ("PeriodID","Ma xPeriod","CoID= " &
request.Cookies ("myco"), DBaccesspayroll )
ckDate=ccdlooku p("CkDate","Per iod","PerID=" & RecID,dbaccessp ayroll)
ckDate=ccformat date(DateAdd("d ",AddPayroll.Ra dioButton1.valu e,ckDate),Array ("yyyy",
"/", "mm", "/", "dd"))
tSQL = "INSERT INTO Period (CoID, CkDate)" & " Values "&
request.Cookies ("myco") & ", #" & ckDate &"#)"
response.Write tSQL
Response.end
Set conn = new clsdbaccesspayr oll
conn.execute(tS QL)
'conn.close
'End Custom Code
The error message I am getting is:
ADODB.Recordset error '800a0e7d'
The connection cannot be used to perform this operation. It is either
closed or invalid in this context.
Any ideas?
Comment