Trying to update records in an Access table linked to a SharePoint list, from VB....

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri Hello.
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Calibri <span style="font-size:small First off, I apologize if this is not the proper forum for this question.<span style="
Where I am working with three different products, I wasnât sure where this question would be appropriate.
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Calibri; font-size:small
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Calibri <span style="font-size:small I am writing a small program to update data in a SharePoint list.<span style="
Now where I cannot develop or use applications for SharePoint unless I am on a SharePoint server, I thought I would cheat the system by using Access to link to SharePoint lists, and then use Visual Basic to play with the Access tables.<span style="
I need additional functionality other than what VBA can provide me, so that is why I am using the VB layer.
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Calibri; font-size:small
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Calibri <span style="font-size:small Is it possible that this is not permitted?<span style="
Whenever I try to update an item in the table, I receive the message:<span style="
"cannot update (expression); field not updatableâ<span style="
The word âexpressionâ here is not a filler I added, this is the actual error.
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Calibri; font-size:small
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri If I try to make the edit manually in the table using Access, it works fine (I havenât tried it through Access VBA yetâ).
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Calibri; font-size:small
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri How my code works is this:

<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri I have a Dataset added to the project which connects to the Access database.<span style="
I add one of the tables to the dataset and create a Class object to reference the table adapter (essentially a Data Access Layer).<span style="
I can read all of the data fine, and when a change is made in SharePoint, my application sees the updates when it refreshes.<span style="
But when I try to write back to the table I get the error message above.<span style="

<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="color:blue; font-family:Consolas; font-size:9.5pt
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="color:blue; font-family:Consolas; font-size:9.5pt For<span style="font-family:Consolas; font-size:9.5pt
<span style="color:blue Each r <span style="color:blue As <span style="color:#2b91af
DataRow <span style="color:blue In TableAdapter.GetData.Select(<span style="color:#a31515 "Name LIKE *" & FileName &
<span style="color:#a31515 "*")
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Consolas; font-size:9.5pt r.BeginEdit()
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Consolas; font-size:9.5pt r.Item(<span style="color:#a31515 "Column1") = âTextâ
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Consolas; font-size:9.5pt r.Item(<span style="color:#a31515 "Column2") = Date
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Consolas; font-size:9.5pt r.EndEdit()
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Consolas; font-size:9.5pt TableAdapter.Update(r) -<span style="font-family:Wingdings; font-size:9.5pt <span style=" Ã<span style="font-family:Consolas; font-size:9.5pt This
is where the error occurs
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="color:blue; font-family:Consolas; font-size:9.5pt Next
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Calibri; font-size:small
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Calibri <span style="font-size:small There are other columns in the table and some of them have default null values.<span style="
I only want to update these two fields, but it almost seems like this is not possible.<span style="
Am I missing something, or is this process an unsupported method?
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri I thought I might be somehow opening the Dataset in a Read Only mode, but I canât seem to find that option anywhere.
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Calibri; font-size:small
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri If anyone can help shed some light on this I would be very appreciative.
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:Calibri; font-size:small
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri Thanks
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri Steve.
<span style="font-family:Times New Roman; font-size:small

View the full article
 
Back
Top