﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / How to make DAO recodset updatable to add a new record to SQL Server 2008 table. / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 23 May 2013 03:53:54 GMT</lastBuildDate><ttl>20</ttl><item><title>How to make DAO recodset updatable to add a new record to SQL Server 2008 table.</title><link>http://www.sqlservercentral.com/Forums/Topic1407025-391-1.aspx</link><description>Hi,I am trying to add a recod to a SQL Server 2008 table using DAO.AddNew. But (). this is giving me Database readonly err at runtime.  I could make out that my recordset is not updatable.http://msdn.microsoft.com/en-us/library/office/bb243801(v=office.12).aspxIs there a way to make it udatable? Is there a way to overcome this problem?Below is my code sample. Database=Sales, User=user, Table name= DocTab1--------------------Option ExplicitDim grsIndexTable As RecordsetDim grsDocTable As RecordsetPublic DBConnection As DatabasePublic oWorkSpace As WorkspacePublic oDbEngine As New PrivDBEnginePublic ErrorLineNum As IntegerPrivate Sub Form_Load()On Error GoTo Error_Handler530 Set oWorkSpace = oDbEngine.CreateWorkspace("Test", "Admin", "")540 Set DBConnection = oWorkSpace.OpenDatabase("", False, False, "ODBC;DSN=Sales;UID=user;PWD=")1020 Set grsDocTable = DBConnection.OpenRecordset("DocTab1")MsgBox (grsDocTable.Updatable)1234 grsDocTable.AddNew1120 grsDocTable.Fields("DocID") = 31130 grsDocTable.Fields("Path") = "My Path"1140 grsDocTable.UpdateExit Sub'---------------' Error Handler'---------------Error_Handler:If (ErrorLineNum = 0) ThenErrorLineNum = ErlEnd IfMsgBox (ErrorLineNum &amp; Err.Description)End Sub-------------------------Thanks for any help,Swapna</description><pubDate>Mon, 14 Jan 2013 22:17:25 GMT</pubDate><dc:creator>swapna 72694</dc:creator></item></channel></rss>