Problem updating query
Hello All,
I am trying to update a query table and keep on getting the folowing error:
Microsoft Cursor Engine error '80004005'
Insufficient key column information for updating or refreshing.
Query1edit.asp, line 263
When I manually update in Access it updatesd both of the source table fine.
<%
'-------------------------------------------------------------------------------
' Function EditData
' - Edit Data based on Key Value
' - Variables used: field variables
Function EditData()
Dim sSql, rs, sWhere, sGroupBy, sHaving, sOrderBy
sSql = "SELECT * FROM [Query1]"
sWhere = ""
sGroupBy = ""
sHaving = ""
sOrderBy = ""
If sWhere <> "" Then sWhere = sWhere & " AND "
sWhere = sWhere & "([Reference] = '" & AdjustSql(x_Reference) & "')"
sSql = sSql & " WHERE " & sWhere
If sGroupBy <> "" Then
sSql = sSql & " GROUP BY " & sGroupBy
End If
If sHaving <> "" Then
sSql = sSql & " HAVING " & sHaving
End If
If sOrderBy <> "" Then
sSql = sSql & " ORDER BY " & sOrderBy
End If
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.Open sSql, conn, 1, 2
If rs.Eof Then
EditData = False ' Update Failed
Else
' Field Reference
sTmp = Trim(x_Reference)
If Trim(sTmp) = "" Then sTmp = Null
rs("Reference") = sTmp
' Field Version Date
sTmp = Trim(x_Version_Date)
If Trim(sTmp) = "" Then sTmp = Null
rs("Version Date") = sTmp
' Field Date Audited
sTmp = Trim(x_Date_Audited)
If Trim(sTmp) = "" Then sTmp = Null
rs("Date Audited") = sTmp
' Field Competent
sTmp = Trim(x_Competent)
If Trim(sTmp) = "" Then sTmp = Null
rs("Competent") = sTmp
' Field Auditor
sTmp = Trim(x_Auditor)
If Trim(sTmp) = "" Then sTmp = Null
rs("Auditor") = sTmp
' Field Findings/Action Plan
sTmp = Trim(x_Findings2FAction_Plan)
If Trim(sTmp) = "" Then sTmp = Null
rs("Findings/Action Plan") = sTmp
rs.Update
EditData = True ' Update Successful
End If
rs.Close
Set rs = Nothing
End Function
%>
Any ideas????
|