Answered by:
Why am I getting a Write Conflict pop-up with a grayed out "save record" button in Access?

Question
-
Good Morning everyone.
I haven't worked a whole lot in Access development and have taken over duties on a pre-existing DB. I added a couple of columns to a table in SQL as there are multiple data connections in the Access DB. I specifically added two columns to a table that is used in a couple of sub-forms.
In the form "frm_users" There is a spot to Edit Existing Users. Anytime that I try and add a new value in that field I get a write conflict pop-up and it does not allow me to save the record. Therefore nothing can be edited.
Thursday, April 26, 2018 1:42 PM
Answers
-
So I figured out what the problem was just today. Thanks for all who responded. This certainly was a weird one.
The records I was trying to edit was only 1 of 3 records. Out of the 3 records that are in a linked table between SQL Server and Access, all three were added via a script in SQL Server. The error only happened when trying to edit those records no other pre-existing records.
To list all of the steps that were taken would be quite a long list. Essentially what I did was manually delete them via a script in SQL Server (3 records that is). Then manually added them in the table in Access. The functionality on the form worked as it was supposed to.
- Proposed as answer by Terry Xu - MSFT Thursday, May 3, 2018 5:34 AM
- Marked as answer by stillanoob Thursday, May 3, 2018 11:55 AM
Wednesday, May 2, 2018 6:17 PM
All replies
-
Once you alter a SQL Server table that is linked in an Access database you have to either relink or drop the link and recreate it so Access can see the change. This is also true of views if either the view is changed or an underlying table is changed.
I always include a table that contains records of when the SQL Server database is changed in any way and a local table that indicates when the SQL tables were last relinked. My code in my main menu form's Activate event compares the dates of the latest records in the two tables and triggers a relink if necessary.
Bill Mosca
www.thatlldoit.com
http://tech.groups.yahoo.com/group/MS_Access_ProfessionalsThursday, April 26, 2018 2:50 PM -
Bill, thanks for your response.
I was thinking that, that maybe the scenario. I did relink the table but never dropped/deleted the connection to the table previously. I just renamed the new connection. When I did that it still gave me the error.
I'm just worried about re-linking all of the controls tied to that table. As of right now I know for a fact that it would effect that one form. But there are around 5-7 other forms that it may effect. Do you know if I'd have to re-bind the controls to the table after deleting both of the connections I have now and starting fresh?
Thanks again for your response. If I can get to this today I will delete both the linked tables and start with a fresh connection and post my results here for future help if anyone runs into a similar issue.
Thursday, April 26, 2018 3:47 PM -
You shouldn't have to re-bind any controls or redesign any queries. Refreshing the links should be all that you need.
Bill Mosca
www.thatlldoit.com
http://tech.groups.yahoo.com/group/MS_Access_ProfessionalsThursday, April 26, 2018 3:51 PM -
I deleted both of the connections. I then re-connected the table. Went into the form where I was trying to previously edit information. Same error popped-up. Now I'm really at a loss. I would have thought your method would have been the fix.Thursday, April 26, 2018 4:54 PM
-
If you have Bit fields in your SQL Server tables, make sure that they have default values and do not allow NULLs. And/or add a timestamp column.
Make sure to relink after doing this.
Miriam Bizup Access MVP
- Edited by mbizup MVP Thursday, April 26, 2018 5:28 PM Added reminder to re-link.
Thursday, April 26, 2018 5:25 PM -
I do have a couple of bit fields in the table. All of which have been set to allow NULL values. I did see on another forum setting a timestamp column. I'm sort of lost on how at all that has anything to with the issue at hand though. I will however try testing it out tomorrow morning.Thursday, April 26, 2018 6:08 PM
-
Hello stillanoob,
Are you in an multiple-user environment? Will the data be locked by another user?
If you click Copy to Clipboard or Drop Changeds and then re-edit the record, will you still get the Write Conflict pop-up?
Best Regards,
Terry
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Friday, April 27, 2018 6:30 AM -
>> All of which have been set to allow NULL values.
I've never seen a 'why' explaining the reasons, but this has definitely been a known cause of write conflict errors in Access/SQL environments as far back as my database developer memory goes.
Check out Armen Stein's more detailed post on this topic.
EDIT:
As an aside if your goal in allowing NULL values in a bit field is to have triple-state checkboxes on your Access forms, use an integer field instead. This will avoid the write conflict issue caused by null bit fields, and produce the following behavior in your checkbox:
Int Field Checkbox
--------------------------------
NULL Greyed (ambiguous)
0 Clear (unchecked)
Non-zero int Checked
Miriam Bizup Access MVP
- Edited by mbizup MVP Friday, April 27, 2018 10:48 AM
Friday, April 27, 2018 10:28 AM -
The issue with any Boolean fields not having a default value is that the value is null unless specifically set as true or false. That's fine within sql server itself but not if it is a linked Access table. Access boolean fields only have two states and it cannot handle null values. So ALWAYS set a default value in Sql serverSaturday, April 28, 2018 7:37 PM
-
When dealing with a SQL back end, there are some things you have to watch out for.
SQL Server fields are called columns. I will refer to them as such for the sake of clarity.
There are some differences of which you must be aware.
Yes/No fields are bit columns in a SQL table.
A bit column can be null, zero or 1. In Access, a Yes/No field is either 0 or -1. Bit columns display in Access as 0 or -1. But in this case, what is displayed is not always what is real.The 0 could be 0 or null. Access will choke on nulls in that type of field. You MUST make sure all nulls are updated to 0. In fact, it is a good practice to make a default of 0 for bit columns.
The -1 is actually 1. All queries that have a bit column in the criteria that is equal to -1 must be changed to either = 1 or <>0.
Any table or view** that is not static MUST have a unique index.
Any competent SQL DBA will tell you every table should have a clustered Primary Key, or, if it is not clustered there should be another clustered index on the table. Tables and views without unique indices are not updatable. The error message you get (if any) is too vague to let you know this.Any design change made to a table or view will not show up in the Access front end.
You must relink the object. If you try to insert a value in the new column through VBA without relinking the value will go into the column that used to have the new column's ordinal position.Let's say you have a SQL table with columns in this order:
CustomerID int IDENTITY(1,1) - Same as an AutoNumber in Access starting at 1 and incrementing by 1
CompanyName varchar(50) - Same as a text (50) in Access
Address varchar(50)Then you create a new column Rating int and put it in the table right after CompanyName. Should you try to update Rating the data will actually go into Address. In this case, there will be no error because whatever alpha-numeric value you enter will be accepted in the Address column provided it is not too big.
See the potential for disaster?
Sometimes if you change an object used by a view, not only will Access not see the change without a relink, but SQL might not even see the change until you run a DDL command of sp_refreshview @viewname = MyView to update the view's metadata.
Relinking a view causes it to no longer be updatable.
When you link to a view Access will ask you to select field(s) that makes a record unique. While you do not have to do this, if you don't, the view will not be updatable. Relinking manually might lose the unique index that Access creates. If you relink through VBA the index will not be kept unless you write code to do it.Using the Format property in a form or report will not always work.
I have had the formatting ignored whether I use the control's Format property or the Format() function directly in the query. I worked around this by using the Format() function directly in the ControlSource as in:
=Format([Amount], '#,###.00')This bug may have been fixed, but if it hasn't at least you will be aware of it if it bites you.
DAO code modifications
There are a couple changes you will need to make when working with DAO. You need to include the argument "dbSeeChanges"
1. Recordsets:
Set rs = db.OpenRecordset("SELECT Top 1 * FROM ErrorLog", _
dbOpenDynaset, dbSeeChanges)2. Executing a SQL statement:
CurrentDb.Execute strSQL, dbFailOnError + dbSeeChanges
Bill Mosca
www.thatlldoit.com
http://tech.groups.yahoo.com/group/MS_Access_ProfessionalsMonday, April 30, 2018 1:50 PM -
Hello stillanoob,
What's the state of the issue? Has it been solved? Please feel free to follow up to let us know your current issue.
Best Regards,
Terry
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Wednesday, May 2, 2018 6:56 AM -
So I figured out what the problem was just today. Thanks for all who responded. This certainly was a weird one.
The records I was trying to edit was only 1 of 3 records. Out of the 3 records that are in a linked table between SQL Server and Access, all three were added via a script in SQL Server. The error only happened when trying to edit those records no other pre-existing records.
To list all of the steps that were taken would be quite a long list. Essentially what I did was manually delete them via a script in SQL Server (3 records that is). Then manually added them in the table in Access. The functionality on the form worked as it was supposed to.
- Proposed as answer by Terry Xu - MSFT Thursday, May 3, 2018 5:34 AM
- Marked as answer by stillanoob Thursday, May 3, 2018 11:55 AM
Wednesday, May 2, 2018 6:17 PM -
Hello stillanoob,
I'm glad to hear that you have solved the issue. I would suggest you mark your solution as answer to close this thread. If you have any other issue, please feel free to post threads to let us know.
Best Regards,
Terry
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Thursday, May 3, 2018 5:35 AM -
Thanks for all of those who followed up on this issue.
I really hope that this will help someone in the future. I'm not quite sure what it was about entering the records in SSMS rather than the Access side but that seems to have been the issue.
So in conclusion those who have a SQL back end and have tables tied to an Access front end enter any new records directly into Access tables, because ...................... Microsoft.
Thursday, May 3, 2018 11:57 AM -
It could be that you don't have a primary key that Access recognizes. Did you try dropping the link and then linking the table again to see if that fixes future inserts?
Bill Mosca
www.thatlldoit.com
http://tech.groups.yahoo.com/group/MS_Access_ProfessionalsMonday, May 7, 2018 6:36 PM