Solved

Cannot modify record in Access Query

Posted on 2014-11-06
10
269 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSIS with VPN COnnection 2 70
Create report using crosstab query 11 29
Find results from sql within a time span 11 29
backup programme - VBA 3 24
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

776 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