Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Cannot modify record in Access Query

Posted on 2014-11-06
10
Medium Priority
?
287 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 2000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

721 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