MS-ACCESS 365 Write Conflict Issue - vba

After my Access got upgraded to Office 365 i'm starting to get write conflict issue whenever i edit a particular record. I was not getting this error in 2010 version.
Access database has 1 query used to filter out selected record for editing and 1 form (no subform). On some records i was able to update, but on some records i'm getting a write conflict. I'm using a run command DoCmd.RunCommand acCmdSaveRecord to save each record that is updated. Do you have an idea why changes are saved on some records and why a write conflict on some. There's no other users editing the record.
Thanks

Whenever I have issues with msaccess that I cannot explain, I do the following:
1-) Create a new msaccess empty file;
2-) Import all tables / queries / forms, objects to this new msaccess file
It normally solves this kind of issue.

I had this issue with some of my clients in the past; Most of the times it is resolved by applying the following instruction:
Select File > Options.
In the Access Options dialog box, select Current Database.
Under Application Options, select the Compact on Close check box.
Select OK.
Close and reopen the database for the option to take effect.
More details are here: https://support.microsoft.com/en-us/office/compact-and-repair-a-database-6ee60f16-aed0-40ac-bf22-85fa9f4005b2

You might have a bit field in your table that allows NULL, making it a triple-state field. Whenever you attempt to save your record, if it is null, it can raise this "Write Conflict" error.
The solution would be either to explicitly assign a value to it before saving, or use a default. Alternatively, if you have a bound control to it (like a CheckBox), set its Triple State property to False.

Related

MS Access - "This Record Has Been Changed By Another User Since You Started Editing It"

I know this has been asked many times, and I have tried many of the suggestions and solutions that worked for others, but I am not able to get this error to go away (please see attachment).
This is an Access application that is really just a UI to a SQL Server database, and uses all linked tables to the SQL Server database. The user opens access and they go to a form that opens a "Search", where the user selects a bunch of criteria and clicks "Apply Filter". A list of records appears that meet their criteria. They click the record they want, and a form is opened that displays the details about this record. They then click an "Edit" button that opens another form that allows them to edit certain fields. When they make changes and hit save is when this error appears. The odd thing to me, this only occurs if the user selects the first record in the Search list, but it doesn't seem to happen with the others in the list.
What I have tried is the following:
Added code on the "BeforeUpdate" and "Update Button Click" event to check "If Me.IsDirty = True Then Me.IsDirty = false" End If.
Added a datetime column to the SQL database that gets updated with a trigger ON UPDATE
Verified the database has no bit columns
Changed the "Record Locks" property on the form to "Edit Records"
None of these items made a difference.
Any help on what might be causing this is appreciated.
2. Added a datetime column to the SQL database that gets updated with a trigger ON UPDATE
This could actually be the cause of your problem - Access and Sql Server modifying the same row at the same time is causing the write conflict you see.
I'm afraid you have misinterpreted the valid advice you found.
What you want is a ROWVERSION aka TIMESTAMP column in your Sql Server table. That helps Access figuring out if a row has changed and solve write conflicts. It is fully automatic and needs no trigger.
More details (Albert always provides lots of details :p ) here:
MS Access Write Conflict - SQL Server - Me = Dirty
If this doesn't help: check if you have any other triggers, and post your VBA code for filter / edit / save.

Stumped as to why Access is asking me to enter a parameter

I have a combo box called "manufacturer" that will update the combo box called "productName" but when I select the manufacturer, I get a prompt asking for the parameter. The SQL statement for the ProductName query is below.
SELECT ProductsTable.ProductID, ProductsTable.ProductName,
ProductsTable.ManufacturerID
FROM ProductsTable
WHERE (((ProductsTable.ManufacturerID)=[Forms]![NewComplaint]![manufacturer]))
ORDER BY ProductsTable.ProductName;
When the Manufacturer is selected, this is the prompt that is displayed.
The solution was quite unexpected: your database is corrupted in a way that I haven't seen yet (AFAIR).
After opening the form, I tried a few things in the Immediate Window that usally work without problems, and got various errors:
? Forms!NewComplaint.Name
Automation Error
? Form_NewComplaint.Name
Not enough memory
Compact & Repair and Decompile didn't help.
Solution: Create a new database, import everything from the existing database.
Now the combo boxes work without problems.
See http://allenbrowne.com/ser-47.html
(and for possible future problems: http://allenbrowne.com/recover.html)

Fields added to SQL Backend lock the records in MS Access

We have a database that is using a SQL Server backend with a MS Access and Filemaker frontend. It has been working fine. I added two fields to one of the tables today, one datetime field and one bit field.
When the table was updated in Access they can no longer edit a field in the records. A Write Conflict error comes up
"The record has been changed by another user since you started editing it. If you save the record, you will overwrite the changes the other user made. Copy the changes to the clipboard will let you look at the values the other user entered and then paste you changes back in if you decide to make chages.
The save Record option is grayed out.
Any ideas what the problem could be?
Is the bit column nullable? MS Access can show those symptoms when dealing with a nullable bit column.

Update multiple records in SQL from Access without error "The data has been changed"

I am working with an ODBC connection between Access 2013 front end and a SQL Server 2008R2 back end. I have both “Datasheet” and “Continuous” forms that display multiple records which are sorted on an “order” field (integer).
The record source of these forms is a query (an Access local query right now, but I don’t think that switching it to a SQL Server view will solve my problem). Users use these forms to set/update the order of their records for reporting purposes.
My problem: the forms are updateable, but keep throwing the error
The data has been changed. Re-edit the record.
I know this error can be solved by setting the respective form to re-query after every update, but that is equally frustrating to the user because then their records are constantly re-sorting on them as they are trying to set the order (and the form "blips" after every entry).
(I have the field "Timestamp" in all my tables. I know a similar error is raised if one does not have this field in a SQL BE database linked to an Access FE.)
What is the best way to allow the users to update the order of all their records without the form resorting on them? (I would like to keep the “sort” in the query on the “order” field so when they open the form next time it displays the records in the order they specified.) I’ve read about using unbound forms with a stored procedure to update the SQL data, but this seems to be useful for one record at a time. Could I use a temp local table, and then do a batch update with a stored procedure? If that is the best answer, I also ask for some example code to get me headed in the right direction. :)
A simple answer! Add Me.Refresh to the AfterUpdate event on the form or subform. Then when a user does want to update the form based on their new order, they can click a "refresh" button that is set to Me.Requery or Me.Parent.Requery depending on the form or subform, respectively.

Microsoft access DoCmd.GoToRecord

I'be been given a MA DB and I had to connect that to a MySQL server using ODBC. That was fine. Then I added a subform in the main form that shows all the "attachfiles" related to the main form. That looks fine too. I even created a button to add a new record of attachfile (I save only the path on the table) related to the current form (to the current object that is editable with the form). And another button that deletes all this records related to the current main form. It all looks fine.
But then when I try to create a new record of the main form it complains, runtime error 2105, you can't go to the specified record.And it highlights this line:
DoCmd.GoToRecord , , acNewRec
Why does that happen? With the DB that I was given, it adds a new record with no problem (but there was no subform and tables weren't linked). I am totally new to VBA and I am not sure if the problem is more for using the connector to MySQL or for the modifications I did. I am quite lost.
Any directions?
Double-check that the Record Source property of the form points to a valid linked table in the database. Sometimes when converting from local tables to linked tables the names can get muddled up (e.g., [Invoices] vs. [Invoices1]).