Solved

Cannot modify record in Access Query

Posted on 2014-11-06
10
277 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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
 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

820 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