Solved

Cannot modify record in Access Query

Posted on 2014-11-06
10
282 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 58

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 58
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 58
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
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.
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 …

622 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