Seems to be what is happening and happening repeatedly, and seems to be what the answers.microsoft.com thread is describing also.Primary keys do not revert to non-keys (in a non-corrupted table) unless done purposely as stated here:
I don't think so. I could figure out how to write DDL code (I think) to change it, but I haven't done so, and I don't think anyone else with access to the db knows how to write code to do this and/or knows how to do it manually either.Is there code anywhere that could be doing this?
Unlikely. There is only one production backend. I fairly often switch to a local backend for development work, but the other users do not and the errors are occurring in the production backend.The last possibility could be switching between different back ends or local. Maybe you are relinking to an old backend.
That pattern very much resembles my recollection of the problem at the client I mentioned. They also printed the Primary Key values on documents emailed to clients, so it was a highly visible problem. That's why we caught it so quickly; the person handling notifications was very competent and spotted the duplicated PKs.@ GPGeorge - That helps. I do run a nightly C&R on the backend. So it is POSSIBLE the BE was corrupted, the C&R removed the PK and then a later corruption/error allowed the duplicated record.
@jdraw - I have a procedure to check for unknown records. I don't have a procedure to confirm that the table has a PK. I noticed that the records that were duplicated had the same value for the PK field, so I checked if this was still marked as the PK for the table and it wasn't. Then after I changed it, I checked again to ensure it stayed set.
One member of our team uses the front end on a OneDrive folder - but he just started yesterday.
If you are doing a compact & repair during the same time frame when it is possible that a user wants to add or update records--and it sounds like you were within 15 minutes there--you are begging for corruption, IMO. It must be absolutely one way or the other. Don't touch the backend if it's possible someone has it open. And vice versa; make sure no one tries to open it when you are conducting maintenance.Found a new wrinkle and now I am highly confused.
The first issue that I found with a field not having a defined primary Key and having duplicated records occurred on 17-Jun.
I deleted or restored the records on 17-Jun and verified each table had a defined primary key.
The duplication I found today occurred in Table A.
I looked at our backups, and Table A had a defined Primary Key on the backup files from 17-Jun, 18-Jun, 19-Jun, 20-Jun, and 24-Jun at 7:00 P.M.
Table A does not have a defined Primary Key currently - I don't believe. I don't have exclusive access to the database, but I looked at the Table in read-only mode in design view and it doesn't have the key icon by the field, but it does have that for Table B.
Now the really strange thing - I found the duplicated record in a comparison report run at 6:45 P.M. last night.
So at 6:45 P.M., the database had a duplicated record, including the Primary Key field value, which is NOT SUPPOSED to be able to happen with a defined PK. But 15 minutes later, the backup of the database shows a defined PK field.
(We run a program at 7:00 P.M. that does a copies the backend to the local computer, does a C&R, and creates a backup, but I'm not sure if it does the backup before or after the C&R. I think the backup is first.)
Either way, I'm not sure how the database has a fully duplicated record 15 minutes BEFORE it still had a defined PK, and then somehow the defined PK was removed this morning. (The defined PK could have been removed during the C&R right after last night's backup, but that seems like an odd co-incidence and also doesn't explain how the record was duplicated including the PK value.)
???
You can easily stop users using the master copy of the database. Just use a sentinel file of some sort. I have an ini file to store some info. The ini file is in the users home folder, but isn't in the folder that stores the master copy. If a user opens that version, it just warns them that there is no ini file and then closes.4 of our users have the front end on their desktop and open it from there.
4 of our other users are running the database from Citrix and (are supposed to) open it from a network path that is unique to each user and is mapped to U:\
They can't write to the Citrix desktop and they can't access company files outside of citrix, so a desktop shortcut won't help.
We use a script that updates the database from the default location, but sometimes it didn't work, so I posted the front end on another network path.
They are SUPPOSED to COPY the database from the network path to their mapped U:\ drive, but I've seen locking files on the distribution path, so I know some of them have opened it from there. I've warned them not to do that, but ...
I don't know that more than one of them has opened it from the distribution folder at the same time, but I wouldn't rule it out ...
Marshall, I thought you were also checking/confirming that each table had a PK defined. If you had a routine to do so, it might help in diagnosis. It would be quick running and read-only. (AFAIK) Quick and automated to show that a PK(s) had been dropped/compromised.@jdraw - I have a procedure to check for unknown records. I don't have a procedure to confirm that the table has a PK. I noticed that the records that were duplicated had the same value for the PK field, so I checked if this was still marked as the PK for the table and it wasn't. Then after I changed it, I checked again to ensure it stayed set.
I've been checking that, but I've been doing so manually. An automated check would be nice, but I'm not sure how to code it.Marshall, I thought you were also checking/confirming that each table had a PK defined.
@The_Doc_Man - Solved the OneDrive issue. The new users Desktop folder is on OneDrive but I was able to create a C:\Users\username\Desktop folder and put the FE there and put a shortcut on the OneDrive Desktop to open the FE.
This is not the issue and is resolved - although it wouldn't have been if you had not commented - much appreciated. See Reply #192. The FE was on OneDrive on Monday night and Tuesday morning, but the user isn't actively working in the database yet, and the file duplication happened apparently around the 18th.According to your comment, the user's desktop is on OneDrive and thus the FE file is also on OneDrive.
I don't believe the BE is subject to OneDrive, but I'm not certain. The BE is on \\networkname\networkdirectory. There is no OneDrive in the directory tree and there was in the new users Desktop folder location. OneDrive is new to us at the user level, so I'm not certain how it and where it is being utilized.PLEASE tell me that the BE is also not subject to OneDrive periodic backups. Because if you have a crash during a long transaction and try to restore, your backup copy will be unusable.
Let's look at the second part of this ... Half of our team (8 users total) operates with the FE on the users desktop on the local machine (C:\Users\username\desktop). The newest team member is using a SHORTCUT on the OneDrive Desktop to open the FE in the stated folder.Your solution MUST be to have the FE on a purely local (i.e. outside of the range of OneDrive's reach) folder on the user's desktop system, or one of Pat Hartman's CITRIX/RDP solutions with a private folder on the RDP server.
I don't want to get into an argument or semantics of whether or not it is considered corruption. I have tables in the backup file that were labelled as PK and are not labelled as PK in the current file. I have tables in the backup file where two records have identical values in the PK field, which is not supposed to be possible with Access, as far as I understand it (which isn't that far).In addition: table definitions do not simply change at will, sometimes PK, sometimes not, values duplicate themselves or disappear. This is nonsense.
This can only be understood as corruption in the tables, and a third party is involved.
Yes, backend is an Access file. Tables in question are linked into the FE from the BE. As far as I can tell, the third sentence shouldn't be happening. Most users don't know where the BE file is located to try to run backup or compression on it. I run a nightly unattended routine that does this, but there is a routine that kicks all users out first and the routine will fail if anyone is in the file (and I can verify it failed), but that hasn't happened during the time the duplication has occurrred.Are we talking about the backend being an Access file and all the tables being viewed being in this backend? A file is a stupid creature and cannot defend itself against external measures. If a user is currently carrying out write operations and another user or an admin service is simultaneously carrying out copying or compression measures on this file, this is potentially problematic and can lead to corruption.