unified
08-24-2006, 07:47 PM
:banghead: I'm using Excel 2000 and Access 2000, and I am trying to add a new record to a table. I'm using the code below, and I keep getting an error stating : "Current recordset does not support updating". I realize that there must be a better way of writing this, but my searches on the internet only gained ASP examples that were not even close to what I am trying to do. I will eventually use Excel to update the table. Can anyone point me into the right direction, as well as any links to tutorials or books?
Dim Conn, RS
Dim QueryStr As String
Set Conn = CreateObject("ADODB.Connection")
Set RS = CreateObject("ADODB.RecordSet")
QueryStr = "SELECT * FROM NURSES"
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\whitestone\whitestone.mdb"
RS.Open QueryStr, Conn
'MsgBox RS!FirstName <-- used to test connection
'MsgBox RS!LastName <-- used to test connection
RS.AddNew
RS!FirstName = "Octavius"
RS.Update
Conn.Close
Set Conn = Nothing
Dim Conn, RS
Dim QueryStr As String
Set Conn = CreateObject("ADODB.Connection")
Set RS = CreateObject("ADODB.RecordSet")
QueryStr = "SELECT * FROM NURSES"
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\whitestone\whitestone.mdb"
RS.Open QueryStr, Conn
'MsgBox RS!FirstName <-- used to test connection
'MsgBox RS!LastName <-- used to test connection
RS.AddNew
RS!FirstName = "Octavius"
RS.Update
Conn.Close
Set Conn = Nothing