Solved

Cannot modify record in Access Query

Posted on 2014-11-06
10
264 Views
Last Modified: 2014-11-06
I have an Access 2010 FE that is linked to SQL Server 2005 for the BE.

I have a query that is simply ALL records from Table A. I can modify a record in this query and it will update without problem.

If I add criteria to the query, such as only records for customers in California, it will no longer allow me to update the data. I get a message that states "Write Conflict. The record has been changed by another user......etc etc".

Why is this happening. It did not used to happen when I programmed in earlier versions of Access.

Thanks for any help you can provide.
0
Comment
Question by:GenesisTech
  • 5
  • 3
  • 2
10 Comments
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 40427045
It depends how you apply the criteria. If it is locally (ie via an Access query) you should still be able to. If however you alter an underlying sql in SQL Server, then Access will think that the change is made by someone else. If the query is delivered to a form for editing, after adding the criteria, try using VBA to refresh the form. This should resolve it.


Kelvin
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 40427062
You need to add a time stamp field to usable row versioning (which is best). Or make sure you choose a unique key when linking.    Also if you have any bit fields that allow nulls or floats, you'll have problems wit updates.

Jim
0
 

Author Comment

by:GenesisTech
ID: 40427064
Kelvin,

Even if I go straight into the query window it will not allow me to make an update.

I execute select query with no criteria in Access Query window - I can click into record and make a change no problem.
I execute select query with ="CA" in the grid for state - I can click into record and make a change - when I click out, BAM Write Conflict.

Very strange. Everything is being done directly in Access. I am not even trying to do it through the form.

Thoughts?
0
 

Author Comment

by:GenesisTech
ID: 40427072
Jim,

I cannot see how the unique key would allow me to make changes when there is no criteria but not make changes when there is.
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 40427225
And you are just querying one table - no joins to another table?

Kelvin
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:GenesisTech
ID: 40427249
no joins - no nothing. Very simple straight forward select query.
0
 
LVL 57
ID: 40427253
It has to do with the way jet handles ODBC record processing which is with a key set cursor model. When you update jet actually reselects the record and if it can't find it or thinks it's changed you'll get a write conflict Error.

  That can be caused by a trigger that modifies one of the key fields.
But typically it's due to a field that is either a bit or a float.  It can also be caused by a key that is not entirely unique that's why it's good to have a timestamp field in the table.  It's really not a timestamp field but what it does is enables roll versioning in SQL server.

If jet sees this it will select that for its primary key and use that to reselect the record that will get rid of write  conflict.

Jim
0
 
LVL 57
ID: 40427256
And apologies for the formatting of the last post I'm using my phone and it doesn't always work so well
0
 

Author Comment

by:GenesisTech
ID: 40427271
My ID fields are unique and Access recognizes them as Key Fields. They were identified as key fields when linking the tables.
0
 

Author Closing Comment

by:GenesisTech
ID: 40427412
Jim,

You were spot on. KB Article 280730 describes it exactly. I have BIT fields that allow, and have, NULL values.

BTW - I tested 2 potential solutions. In one test, I removed the NULL Values and set all fields to False. Problem went away. In another test, I added a "VerCol" field with datatype TimeStamp to the table. Now none of my records have the problem.

Thanks for your help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now