473,320 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Write Conflict Error When Saving Form Bound to Ado recordset.

I have an access form that is bound to an ado recordset using the following code in the form open event.

Expand|Select|Wrap|Line Numbers
  1.    Dim cn As ADODB.Connection
  2.    Dim rs As ADODB.Recordset
  3.  
  4.    'Use the ADO connection that Access uses
  5.    Set cn = CurrentProject.AccessConnection
  6.  
  7.    'Create an instance of the ADO Recordset class, and
  8.    'set its properties
  9.    Set rs = New ADODB.Recordset
  10.    With rs
  11.       Set .ActiveConnection = cn
  12.       .Source = "SELECT * FROM tblwork where Job = " &  JobNumber
  13.       .LockType = adLockOptimistic
  14.       .CursorType = adOpenKeyset
  15.       .Open 
  16.    End With
  17.  
  18.    'Set the form's Recordset property to the ADO recordset
  19.    Set Me.Recordset = rs
  20.  
  21.    Set rs = Nothing
  22.    Set cn = Nothing
  23.  
  24.  
The form loads the data perfectly but if I modify any of the fields on the form and try and save the changes
I get an write conflict error. What am I missing here? Any help to point me in the right direction would be great.
Dec 22 '10 #1
1 2490
Rabbit
12,516 Expert Mod 8TB
In your code you locked the records but you don't unlock them. I don't know why you lock the records in the first place seeing as how you're only reading them.

However, none of this matters since I'm struggling to understand why you chose to set the record source in this fashion. Why not just set the record source to "SELECT * FROM tblwork" and then filter by job number when the form is opened.
Dec 22 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Michael Kennedy [UB] | last post by:
Hi Everyone, I have this multithreaded C# windows forms application which does a lot of image processing. Occasionally, I get the following error: A generic error occurred in GDI+....
3
by: Fardude | last post by:
I have a few tables in SQL Server 2000 and a small Access 97 that has linked tables used to insert/update/delete into SQL Server 2k tables. Everything works fine except Updating one of these...
0
by: Smriti Dev | last post by:
Hi, I have a ms access table table which is linked to a mysql database table. I have used a ms access form to edit records. However, when I attempt to edit a record I get a write conflict error...
0
by: manning_news | last post by:
Using A2K. I've got a form for clients that has a subform that is a cartesian product between client ID and a lookup table for types of income. So each client has the exact same number of income...
3
by: rivka.howley | last post by:
I recently added some code to the BeforeUpdate event of a text box on a form. The code uses the new value in the text box to recalculate some values in another table, which is shown in a subform on...
1
by: Kuriandungu | last post by:
Hi guys I've read the posts on Write conflict entered in this forum (along with some from kbAlertz and microsoft) and i have tried all the solutions without success. let me give you some background....
1
by: S.Dickson | last post by:
I have a database with access as front end and Mysql as back end. I am gettting the following 'Write Conflict' Error. when i am on my order form, This form does has a subform where i enter all the...
2
by: mrsgwen90 | last post by:
I am trying to update a record using access as the front end and VB 6.0 as the backend. I am using a SQL statement to accomplish this. But I am getting the "Write Conflict Error". I have tried...
3
by: gazsharpe101 | last post by:
Hi everyone, I am doing some work on my company's database. It is a MS Access 2003 front-end with an SQL back-end. Recently, I have asked the database administrator to add some new fields to...
0
by: Tony K | last post by:
ERROR MESSAGE RECEIVED WHEN SAVING. "The operation could not be completed. No such interface supported." Dell Inspirion E1705, 1GB RAM, Windows Vista Ultimate I can start debugging and the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.