when I try to update a record, I get the following error message:
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
I can select the record, but not update it. Here is the code:
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsUpdateEntry 'Holds the recordset for the record to be updated
Dim strSQL 'Holds the SQL query for the database
Dim lngRecordNo 'Holds the record number to be updated
'Read in the record number to be updated
lngRecordNo = CLng(Request.Form("ID"))
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("bosinventory.mdb")
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=bosinventory"
'Create an ADO recordset object
Set rsUpdateEntry = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblComments.* FROM tblComments WHERE ID=" & lngRecordNo
'Set the cursor type we are using so we can navigate through the recordset
rsUpdateEntry.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
rsUpdateEntry.LockType = 3
'Open the tblComments table using the SQL query held in the strSQL varaiable
rsUpdateEntry.Open strSQL, adoCon
'Update the record in the recordset
rsUpdateEntry.Fields("Name") = Request.Form("name")
rsUpdateEntry.Fields("Office") = Request.Form("office")
rsUpdateEntry.Fields("Floor") = Request.Form("Floor")
rsUpdateEntry.Fields("Ext") = Request.Form("Ext")
rsUpdateEntry.Fields("NetworkName") = Request.Form("NetworkName")
rsUpdateEntry.Fields("AssetTag") = Request.Form("AssetTag")
rsUpdateEntry.Fields("MAC") = Request.Form("MAC")
rsUpdateEntry.Fields("PC") = Request.Form("PC")
rsUpdateEntry.Fields("Serial") = Request.Form("Serial")
rsUpdateEntry.Fields("Monitor") = Request.Form("Monitor")
rsUpdateEntry.Fields("MonitorSerial") = Request.Form("MonitorSerial")
rsUpdateEntry.Fields("MonitorAssetTag") = Request.Form("MonitorAssetTag")
rsUpdateEntry.Fields("LocalPrinter") = Request.Form("LocalPrinter")
rsUpdateEntry.Fields("PrinterSerial") = Request.Form("PrinterSerial")
rsUpdateEntry.Fields("PrinterAssetTag") = Request.Form("PrinterAssetTag")
rsUpdateEntry.Fields("Phone") = Request.Form("Phone")
rsUpdateEntry.Fields("PhoneAssetTag") = Request.Form("PhoneAssetTag")
rsUpdateEntry.Fields("Peripheral1") = Request.Form("Peripheral1")
rsUpdateEntry.Fields("Peripheral1Serial") = Request.Form("Peripheral1Serial")
rsUpdateEntry.Fields("Peripheral1AssetTag") = Request.Form("Peripheral1AssetTag")
rsUpdateEntry.Fields("Peripheral2") = Request.Form("Peripheral2")
rsUpdateEntry.Fields("Peripheral2Serial") = Request.Form("Peripheral2Serial")
rsUpdateEntry.Fields("Peripheral2AssetTag") = Request.Form("Peripheral2AssetTag")
rsUpdateEntry.Fields("Comments") = Request.Form("Comments")
rsUpdateEntry.Fields("MoreComments") = Request.Form("MoreComments")
'Write the updated recordset to the database
rsUpdateEntry.Update
'Reset server objects
rsUpdateEntry.Close
Set rsUpdateEntry = Nothing
Set adoCon = Nothing
'Return to the update select page incase another record needs deleting
Response.Redirect "update_select.asp"
%>
Any help would be greatly appreciated