<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/update-to-access-via-ado/m-p/303250#M65294</link>
    <description>I don't have the ADO 2.5 doc's available, so I'll use the 2.7.  ADO&lt;BR /&gt;
certainly does update tables, but can be a little quirky.  A few things I&lt;BR /&gt;
notice:&lt;BR /&gt;
&lt;BR /&gt;
In the recordset Open method Options argument you have used a&lt;BR /&gt;
CommandTypeEnum value of adCmdTable.  That value is intended for use when&lt;BR /&gt;
opening an entire table by name.  To open the recordset using the SQL&lt;BR /&gt;
string, change that argument to adCmdText, or just leave it out.&lt;BR /&gt;
&lt;BR /&gt;
You cannot use an adOpenDynamic CursorType with a adUseClient&lt;BR /&gt;
CursorLocation.  From the doc's:&lt;BR /&gt;
a.. Static cursor - provides a static copy of a set of records for you to&lt;BR /&gt;
use to find data or generate reports; always allows bookmarks and therefore&lt;BR /&gt;
allows all types of movement through the Recordset. Additions, changes, or&lt;BR /&gt;
deletions by other users will not be visible. This is the only type of&lt;BR /&gt;
cursor allowed when you open a client-side Recordset object.&lt;BR /&gt;
&lt;BR /&gt;
Set a Watch on the recordset object, and check it after calling the Open&lt;BR /&gt;
method to see what properties are actually being set.&lt;BR /&gt;
&lt;BR /&gt;
If your strSQL indeed evaluates to&lt;BR /&gt;
SELECT * FROM Hydrant WHERE Hydrant.HydrantId = '9999'&lt;BR /&gt;
then the HydrantId column data type should be Text.  If the data type is&lt;BR /&gt;
numeric, get rid of the single quotes.&lt;BR /&gt;
&lt;BR /&gt;
You do not need the first Update method call.  EditMode is a property&lt;BR /&gt;
intended to test whether the current record has been changed or a new record&lt;BR /&gt;
has been added.  You don't need it in the code below.&lt;BR /&gt;
&lt;BR /&gt;
Check the actual value of the LockType property (in the Watch window) after&lt;BR /&gt;
the recordset is open.  If it is adLockBatchOptimistic then write the&lt;BR /&gt;
recordset with the UpdateBatch method instead of the Update method.&lt;BR /&gt;
&lt;BR /&gt;
Final note, when you attempt multi-table joined recordsets you must use a&lt;BR /&gt;
formal Join clause in the Select statement to get an updateable recordset.&lt;BR /&gt;
Check out the recordset Supports method when you want to find out if a&lt;BR /&gt;
recordset operation is possible for a given provider.&lt;BR /&gt;
--&lt;BR /&gt;
John Goodfellow&lt;BR /&gt;
irtfnm&lt;BR /&gt;
use john at goodfellowassoc dot com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Java Yaboh" &lt;TBERRY&gt; wrote in message&lt;BR /&gt;
news:26300F275FFC704C5B2C613197605E8E@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; Kevin,&lt;BR /&gt;
&amp;gt; Sorry, I haven't used Outlook for newsggroups before...&lt;BR /&gt;
&amp;gt; I have added the relevant section of code below. When I run it with&lt;BR /&gt;
.Update&lt;BR /&gt;
&amp;gt; after opening the connection, I get a "Syntax error in FROM clause."&lt;BR /&gt;
&amp;gt; message.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; Set oConn = New ADODB.Connection&lt;BR /&gt;
&amp;gt; Set oRS = New ADODB.Recordset&lt;BR /&gt;
&amp;gt; oConn.Open CONNECT_STRING&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; strSQL = "SELECT * FROM Hydrant WHERE Hydrant.HydrantId = '" &amp;amp; intHydId &amp;amp;&lt;BR /&gt;
&amp;gt; "'" '', HydrantServiceLine&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; With oRS&lt;BR /&gt;
&amp;gt; .CursorLocation = adUseClient&lt;BR /&gt;
&amp;gt; .CursorType = adOpenDynamic&lt;BR /&gt;
&amp;gt; .LockType = adLockOptimistic&lt;BR /&gt;
&amp;gt; .Open strSQL, oConn, , , adCmdTable&lt;BR /&gt;
&amp;gt; .Update&lt;BR /&gt;
&amp;gt; ''.EditMode&lt;BR /&gt;
&amp;gt; !HydrantX = HydrantX&lt;BR /&gt;
&amp;gt; !HydrantY = HydrantY&lt;BR /&gt;
&amp;gt; !PipeLength = sngConnPipeLength&lt;BR /&gt;
&amp;gt; ''.Update&lt;BR /&gt;
&amp;gt; .Close&lt;BR /&gt;
&amp;gt; End With&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; The resulting query is: SELECT * FROM Hydrant WHERE Hydrant.HydrantId =&lt;BR /&gt;
&amp;gt; '9999'&lt;BR /&gt;
&amp;gt; When I run it in the query designer it works fine and returns the&lt;BR /&gt;
requested&lt;BR /&gt;
&amp;gt; recordset. Just for background, my coding background is Delphi and Java -&lt;BR /&gt;
&amp;gt; I'm new to VBA.&lt;BR /&gt;
&amp;gt; Thank you for your help,&lt;BR /&gt;
&amp;gt; Tom&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; "Kevin Terry" &lt;KEVINT&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:37B4C5CD998B6ABBA140A205971EEA8B@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; Dim rsJob As ADODB.Recordset&lt;BR /&gt;
&amp;gt; &amp;gt; rsJob.Update&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; have you done this, and it doesn't work?&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; --&lt;BR /&gt;
&amp;gt; &amp;gt; Kevin&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; "Java Yaboh" &lt;TBERRY&gt; wrote in message&lt;BR /&gt;
&amp;gt; &amp;gt; news:566C7E9E26967E38E63B8B3FAF87C73C@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; I have a VBA application which records attributes of specialized&lt;BR /&gt;
blocks&lt;BR /&gt;
&amp;gt; to&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; an Access database. I am connecting via ADO (v2.5). I am stumped&lt;BR /&gt;
trying&lt;BR /&gt;
&amp;gt; to&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; figure out how to update records in Access. I have been unable to find&lt;BR /&gt;
&amp;gt; any&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; useful information except that I may NOT be able to UPDATE with ADO&lt;BR /&gt;
and&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; should switch back to DAO instead. If anyone has experience with&lt;BR /&gt;
UPDATEs&lt;BR /&gt;
&amp;gt; &amp;gt; on&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; Access recordsets with ADO, I appreciate hearing from you.&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; Thank you&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; Tom&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/TBERRY&gt;&lt;/KEVINT&gt;&lt;/TBERRY&gt;</description>
    <pubDate>Fri, 07 Mar 2003 09:13:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2003-03-07T09:13:37Z</dc:date>
    <item>
      <title>Update to Access via ADO</title>
      <link>https://forums.autodesk.com/t5/vba-forum/update-to-access-via-ado/m-p/303246#M65290</link>
      <description>I have a VBA application which records attributes of specialized blocks to&lt;BR /&gt;
an Access database. I am connecting via ADO (v2.5). I am stumped trying to&lt;BR /&gt;
figure out how to update records in Access. I have been unable to find any&lt;BR /&gt;
useful information except that I may NOT be able to UPDATE with ADO and&lt;BR /&gt;
should switch back to DAO instead. If anyone has experience with UPDATEs on&lt;BR /&gt;
Access recordsets with ADO, I appreciate hearing from you.&lt;BR /&gt;
&lt;BR /&gt;
Thank you&lt;BR /&gt;
Tom</description>
      <pubDate>Thu, 06 Mar 2003 09:06:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/update-to-access-via-ado/m-p/303246#M65290</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-03-06T09:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Update to Access via ADO</title>
      <link>https://forums.autodesk.com/t5/vba-forum/update-to-access-via-ado/m-p/303247#M65291</link>
      <description>Dim rsJob As ADODB.Recordset&lt;BR /&gt;
rsJob.Update&lt;BR /&gt;
&lt;BR /&gt;
have you done this, and it doesn't work?&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Kevin&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Java Yaboh" &lt;TBERRY&gt; wrote in message&lt;BR /&gt;
news:566C7E9E26967E38E63B8B3FAF87C73C@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I have a VBA application which records attributes of specialized blocks to&lt;BR /&gt;
&amp;gt; an Access database. I am connecting via ADO (v2.5). I am stumped trying to&lt;BR /&gt;
&amp;gt; figure out how to update records in Access. I have been unable to find any&lt;BR /&gt;
&amp;gt; useful information except that I may NOT be able to UPDATE with ADO and&lt;BR /&gt;
&amp;gt; should switch back to DAO instead. If anyone has experience with UPDATEs&lt;BR /&gt;
on&lt;BR /&gt;
&amp;gt; Access recordsets with ADO, I appreciate hearing from you.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thank you&lt;BR /&gt;
&amp;gt; Tom&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/TBERRY&gt;</description>
      <pubDate>Thu, 06 Mar 2003 09:08:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/update-to-access-via-ado/m-p/303247#M65291</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-03-06T09:08:21Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/update-to-access-via-ado/m-p/303248#M65292</link>
      <description>Kevin,&lt;BR /&gt;
&lt;BR /&gt;
Sorry, I haven't used Outlook for newsggroups before...&lt;BR /&gt;
&lt;BR /&gt;
I have added the relevant section of code below. When I run it with .Update&lt;BR /&gt;
&lt;BR /&gt;
after opening the connection, I get a "Syntax error in FROM clause."&lt;BR /&gt;
&lt;BR /&gt;
message.&lt;BR /&gt;
&lt;BR /&gt;
.&lt;BR /&gt;
&lt;BR /&gt;
.&lt;BR /&gt;
&lt;BR /&gt;
.&lt;BR /&gt;
&lt;BR /&gt;
Set oConn = New ADODB.Connection&lt;BR /&gt;
&lt;BR /&gt;
Set oRS = New ADODB.Recordset&lt;BR /&gt;
&lt;BR /&gt;
oConn.Open CONNECT_STRING&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
strSQL = "SELECT * FROM Hydrant WHERE Hydrant.HydrantId = '" &amp;amp; intHydId &amp;amp;&lt;BR /&gt;
&lt;BR /&gt;
"'" '', HydrantServiceLine&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
With oRS&lt;BR /&gt;
&lt;BR /&gt;
.CursorLocation = adUseClient&lt;BR /&gt;
&lt;BR /&gt;
.CursorType = adOpenDynamic&lt;BR /&gt;
&lt;BR /&gt;
.LockType = adLockOptimistic&lt;BR /&gt;
&lt;BR /&gt;
.Open strSQL, oConn, , , adCmdTable&lt;BR /&gt;
&lt;BR /&gt;
.Update&lt;BR /&gt;
&lt;BR /&gt;
''.EditMode&lt;BR /&gt;
&lt;BR /&gt;
!HydrantX = HydrantX&lt;BR /&gt;
&lt;BR /&gt;
!HydrantY = HydrantY&lt;BR /&gt;
&lt;BR /&gt;
!PipeLength = sngConnPipeLength&lt;BR /&gt;
&lt;BR /&gt;
''.Update&lt;BR /&gt;
&lt;BR /&gt;
.Close&lt;BR /&gt;
&lt;BR /&gt;
End With&lt;BR /&gt;
&lt;BR /&gt;
.&lt;BR /&gt;
&lt;BR /&gt;
.&lt;BR /&gt;
&lt;BR /&gt;
.&lt;BR /&gt;
&lt;BR /&gt;
The resulting query is: SELECT * FROM Hydrant WHERE Hydrant.HydrantId =&lt;BR /&gt;
&lt;BR /&gt;
'9999'&lt;BR /&gt;
&lt;BR /&gt;
When I run it in the query designer it works fine and returns the requested&lt;BR /&gt;
&lt;BR /&gt;
recordset. Just for background, my coding background is Delphi and Java -&lt;BR /&gt;
&lt;BR /&gt;
I'm new to VBA.&lt;BR /&gt;
&lt;BR /&gt;
Thank you for your help,&lt;BR /&gt;
&lt;BR /&gt;
Tom&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Kevin Terry" &lt;KEVINT&gt; wrote in message&lt;BR /&gt;
news:37B4C5CD998B6ABBA140A205971EEA8B@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; Dim rsJob As ADODB.Recordset&lt;BR /&gt;
&amp;gt; rsJob.Update&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; have you done this, and it doesn't work?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; Kevin&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; "Java Yaboh" &lt;TBERRY&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:566C7E9E26967E38E63B8B3FAF87C73C@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; I have a VBA application which records attributes of specialized blocks&lt;BR /&gt;
to&lt;BR /&gt;
&amp;gt; &amp;gt; an Access database. I am connecting via ADO (v2.5). I am stumped trying&lt;BR /&gt;
to&lt;BR /&gt;
&amp;gt; &amp;gt; figure out how to update records in Access. I have been unable to find&lt;BR /&gt;
any&lt;BR /&gt;
&amp;gt; &amp;gt; useful information except that I may NOT be able to UPDATE with ADO and&lt;BR /&gt;
&amp;gt; &amp;gt; should switch back to DAO instead. If anyone has experience with UPDATEs&lt;BR /&gt;
&amp;gt; on&lt;BR /&gt;
&amp;gt; &amp;gt; Access recordsets with ADO, I appreciate hearing from you.&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; Thank you&lt;BR /&gt;
&amp;gt; &amp;gt; Tom&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/TBERRY&gt;&lt;/KEVINT&gt;</description>
      <pubDate>Thu, 06 Mar 2003 09:28:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/update-to-access-via-ado/m-p/303248#M65292</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-03-06T09:28:22Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/update-to-access-via-ado/m-p/303249#M65293</link>
      <description>I don't see anything wrong with that FROM clause.  However, the "Hydrant." is &lt;BR /&gt;
unnecessary and certainly could be removed.  Try it without that.&lt;BR /&gt;
&lt;BR /&gt;
Is "intHydId" really a string?  Its name suggests integer, but then the &lt;BR /&gt;
concatenation would fail.&lt;BR /&gt;
&lt;BR /&gt;
How about just updating the table with SQL?  The DBMS driver is heavily &lt;BR /&gt;
optimized for doing such manipulations.  I forget the VBA convert-to-string &lt;BR /&gt;
functions, but something like:&lt;BR /&gt;
&lt;BR /&gt;
  strSQL = "Update Hydrant set HydrantX = " &amp;amp; _&lt;BR /&gt;
           MakeIntoString(HydrantX) &amp;amp; _&lt;BR /&gt;
           ", HydrantY = " &amp;amp; _&lt;BR /&gt;
           MakeIntoString(HydrantY) &amp;amp; _&lt;BR /&gt;
           ", PipeLength = " &amp;amp; _&lt;BR /&gt;
           MakeIntoString(sngConnPipeLength) &amp;amp; _&lt;BR /&gt;
           " where HydrantId = '"  &amp;amp; intHydId &amp;amp; "'"&lt;BR /&gt;
&lt;BR /&gt;
If you do this, it's most convenient to use the Execute method of the &lt;BR /&gt;
Connection object, because then you get the number of records affected.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
jrf&lt;BR /&gt;
Member of the Autodesk Discussion Forum Moderator Program&lt;BR /&gt;
Please do not email questions unless you wish to hire my services&lt;BR /&gt;
&lt;BR /&gt;
In article &amp;lt;26300F275FFC704C5B2C613197605E8E@in.WebX.maYIadrTaRb&amp;gt;, Java Yaboh &lt;BR /&gt;
wrote:&lt;BR /&gt;
&amp;gt; Kevin,&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Sorry, I haven't used Outlook for newsggroups before...&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; I have added the relevant section of code below. When I run it with .Update&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; after opening the connection, I get a "Syntax error in FROM clause."&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; message.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ..&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ..&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ..&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Set oConn = New ADODB.Connection&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Set oRS = New ADODB.Recordset&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; oConn.Open CONNECT_STRING&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; strSQL = "SELECT * FROM Hydrant WHERE Hydrant.HydrantId = '" &amp;amp; intHydId &amp;amp;&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; "'" '', HydrantServiceLine&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; With oRS&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ..CursorLocation = adUseClient&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ..CursorType = adOpenDynamic&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ..LockType = adLockOptimistic&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ..Open strSQL, oConn, , , adCmdTable&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ..Update&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ''.EditMode&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; !HydrantX = HydrantX&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; !HydrantY = HydrantY&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; !PipeLength = sngConnPipeLength&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ''.Update&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ..Close&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; End With&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ..&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ..&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; ..&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; The resulting query is: SELECT * FROM Hydrant WHERE Hydrant.HydrantId =&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; '9999'&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; When I run it in the query designer it works fine and returns the requested&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; recordset. Just for background, my coding background is Delphi and Java -&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; I'm new to VBA.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thank you for your help,&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Tom&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; "Kevin Terry" &lt;KEVINT&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:37B4C5CD998B6ABBA140A205971EEA8B@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; Dim rsJob As ADODB.Recordset&lt;BR /&gt;
&amp;gt; &amp;gt; rsJob.Update&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; have you done this, and it doesn't work?&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; --&lt;BR /&gt;
&amp;gt; &amp;gt; Kevin&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; "Java Yaboh" &lt;TBERRY&gt; wrote in message&lt;BR /&gt;
&amp;gt; &amp;gt; news:566C7E9E26967E38E63B8B3FAF87C73C@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; I have a VBA application which records attributes of specialized blocks&lt;BR /&gt;
&amp;gt; to&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; an Access database. I am connecting via ADO (v2.5). I am stumped trying&lt;BR /&gt;
&amp;gt; to&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; figure out how to update records in Access. I have been unable to find&lt;BR /&gt;
&amp;gt; any&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; useful information except that I may NOT be able to UPDATE with ADO and&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; should switch back to DAO instead. If anyone has experience with UPDATEs&lt;BR /&gt;
&amp;gt; &amp;gt; on&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; Access recordsets with ADO, I appreciate hearing from you.&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; Thank you&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; Tom&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/TBERRY&gt;&lt;/KEVINT&gt;</description>
      <pubDate>Fri, 07 Mar 2003 04:44:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/update-to-access-via-ado/m-p/303249#M65293</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-03-07T04:44:29Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/update-to-access-via-ado/m-p/303250#M65294</link>
      <description>I don't have the ADO 2.5 doc's available, so I'll use the 2.7.  ADO&lt;BR /&gt;
certainly does update tables, but can be a little quirky.  A few things I&lt;BR /&gt;
notice:&lt;BR /&gt;
&lt;BR /&gt;
In the recordset Open method Options argument you have used a&lt;BR /&gt;
CommandTypeEnum value of adCmdTable.  That value is intended for use when&lt;BR /&gt;
opening an entire table by name.  To open the recordset using the SQL&lt;BR /&gt;
string, change that argument to adCmdText, or just leave it out.&lt;BR /&gt;
&lt;BR /&gt;
You cannot use an adOpenDynamic CursorType with a adUseClient&lt;BR /&gt;
CursorLocation.  From the doc's:&lt;BR /&gt;
a.. Static cursor - provides a static copy of a set of records for you to&lt;BR /&gt;
use to find data or generate reports; always allows bookmarks and therefore&lt;BR /&gt;
allows all types of movement through the Recordset. Additions, changes, or&lt;BR /&gt;
deletions by other users will not be visible. This is the only type of&lt;BR /&gt;
cursor allowed when you open a client-side Recordset object.&lt;BR /&gt;
&lt;BR /&gt;
Set a Watch on the recordset object, and check it after calling the Open&lt;BR /&gt;
method to see what properties are actually being set.&lt;BR /&gt;
&lt;BR /&gt;
If your strSQL indeed evaluates to&lt;BR /&gt;
SELECT * FROM Hydrant WHERE Hydrant.HydrantId = '9999'&lt;BR /&gt;
then the HydrantId column data type should be Text.  If the data type is&lt;BR /&gt;
numeric, get rid of the single quotes.&lt;BR /&gt;
&lt;BR /&gt;
You do not need the first Update method call.  EditMode is a property&lt;BR /&gt;
intended to test whether the current record has been changed or a new record&lt;BR /&gt;
has been added.  You don't need it in the code below.&lt;BR /&gt;
&lt;BR /&gt;
Check the actual value of the LockType property (in the Watch window) after&lt;BR /&gt;
the recordset is open.  If it is adLockBatchOptimistic then write the&lt;BR /&gt;
recordset with the UpdateBatch method instead of the Update method.&lt;BR /&gt;
&lt;BR /&gt;
Final note, when you attempt multi-table joined recordsets you must use a&lt;BR /&gt;
formal Join clause in the Select statement to get an updateable recordset.&lt;BR /&gt;
Check out the recordset Supports method when you want to find out if a&lt;BR /&gt;
recordset operation is possible for a given provider.&lt;BR /&gt;
--&lt;BR /&gt;
John Goodfellow&lt;BR /&gt;
irtfnm&lt;BR /&gt;
use john at goodfellowassoc dot com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Java Yaboh" &lt;TBERRY&gt; wrote in message&lt;BR /&gt;
news:26300F275FFC704C5B2C613197605E8E@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; Kevin,&lt;BR /&gt;
&amp;gt; Sorry, I haven't used Outlook for newsggroups before...&lt;BR /&gt;
&amp;gt; I have added the relevant section of code below. When I run it with&lt;BR /&gt;
.Update&lt;BR /&gt;
&amp;gt; after opening the connection, I get a "Syntax error in FROM clause."&lt;BR /&gt;
&amp;gt; message.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; Set oConn = New ADODB.Connection&lt;BR /&gt;
&amp;gt; Set oRS = New ADODB.Recordset&lt;BR /&gt;
&amp;gt; oConn.Open CONNECT_STRING&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; strSQL = "SELECT * FROM Hydrant WHERE Hydrant.HydrantId = '" &amp;amp; intHydId &amp;amp;&lt;BR /&gt;
&amp;gt; "'" '', HydrantServiceLine&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; With oRS&lt;BR /&gt;
&amp;gt; .CursorLocation = adUseClient&lt;BR /&gt;
&amp;gt; .CursorType = adOpenDynamic&lt;BR /&gt;
&amp;gt; .LockType = adLockOptimistic&lt;BR /&gt;
&amp;gt; .Open strSQL, oConn, , , adCmdTable&lt;BR /&gt;
&amp;gt; .Update&lt;BR /&gt;
&amp;gt; ''.EditMode&lt;BR /&gt;
&amp;gt; !HydrantX = HydrantX&lt;BR /&gt;
&amp;gt; !HydrantY = HydrantY&lt;BR /&gt;
&amp;gt; !PipeLength = sngConnPipeLength&lt;BR /&gt;
&amp;gt; ''.Update&lt;BR /&gt;
&amp;gt; .Close&lt;BR /&gt;
&amp;gt; End With&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; The resulting query is: SELECT * FROM Hydrant WHERE Hydrant.HydrantId =&lt;BR /&gt;
&amp;gt; '9999'&lt;BR /&gt;
&amp;gt; When I run it in the query designer it works fine and returns the&lt;BR /&gt;
requested&lt;BR /&gt;
&amp;gt; recordset. Just for background, my coding background is Delphi and Java -&lt;BR /&gt;
&amp;gt; I'm new to VBA.&lt;BR /&gt;
&amp;gt; Thank you for your help,&lt;BR /&gt;
&amp;gt; Tom&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; "Kevin Terry" &lt;KEVINT&gt; wrote in message&lt;BR /&gt;
&amp;gt; news:37B4C5CD998B6ABBA140A205971EEA8B@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; Dim rsJob As ADODB.Recordset&lt;BR /&gt;
&amp;gt; &amp;gt; rsJob.Update&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; have you done this, and it doesn't work?&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; --&lt;BR /&gt;
&amp;gt; &amp;gt; Kevin&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; "Java Yaboh" &lt;TBERRY&gt; wrote in message&lt;BR /&gt;
&amp;gt; &amp;gt; news:566C7E9E26967E38E63B8B3FAF87C73C@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; I have a VBA application which records attributes of specialized&lt;BR /&gt;
blocks&lt;BR /&gt;
&amp;gt; to&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; an Access database. I am connecting via ADO (v2.5). I am stumped&lt;BR /&gt;
trying&lt;BR /&gt;
&amp;gt; to&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; figure out how to update records in Access. I have been unable to find&lt;BR /&gt;
&amp;gt; any&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; useful information except that I may NOT be able to UPDATE with ADO&lt;BR /&gt;
and&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; should switch back to DAO instead. If anyone has experience with&lt;BR /&gt;
UPDATEs&lt;BR /&gt;
&amp;gt; &amp;gt; on&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; Access recordsets with ADO, I appreciate hearing from you.&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; Thank you&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt; Tom&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt; &amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/TBERRY&gt;&lt;/KEVINT&gt;&lt;/TBERRY&gt;</description>
      <pubDate>Fri, 07 Mar 2003 09:13:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/update-to-access-via-ado/m-p/303250#M65294</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-03-07T09:13:37Z</dc:date>
    </item>
  </channel>
</rss>

