Error 3167 - "Record is deleted" when running an append query. ACCESS 2010 - sql

I'm attempting to run an append query to a linked table (access backend) and I'm getting Error 3167, Record is deleted. I can't seem to find the offending record. But if I change the table to a local table and run the append query, it runs with no problems at all. I've attempted a compact and repair but it's not helped at all.
Any ideas?

For some reason it was popping up with "Record is deleted" when it was trying to append a primary key that was already there. It never had that issue before. So I just added to the where criteria:
"table.id NOT IN (SELECT ID from table)"
Runs perfectly now. Have no idea why it started though.
Thank you for everyone's input.

Related

MS-ACCESS 365 Write Conflict Issue

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.

Why am I getting Error #1054 When I Rename a Table in phpmyadmin

I know there are a lot of #1054 error related questions on here but mine is simply this -
I renamed my table in phpmyadmin (under operations) and get the error
error #1054 Unknown column ~oldtablename.column~ in order clause
when I try to click on the table name to 'browse' it.
If I rename the table back it works ok but then after renaming it again I have the same problem. Why is phpmyadmin asking for an order by with the old name?
Any help appreciated.
EDIT -
I managed to fix it by renaming the column in question and then renaming it back.
I will leave this question open in case anyone else has the same problem (it does not appear to be documented on SO).
Although I have it working now, it doesn't really help me understand what happened. I'd still like to know if I did something wrong (renaming a table under operations) or if it was a phpmyadmin glitch.

VBA - Jet SQL - False error message

Here's the code:
SQL = " DROP TABLE [H:\Archive23\SPX.accdb].[SPX_MissingTimes] "
MsgBox SQL
DoCmd.RunSQL SQL
This code ran without an error message for a week, then, after some changes in unrelated code following it, it started generating this message:
Microsoft Visual Basic
Run-time error '3295':
Syntax error in DROP TABLE or DROP INDEX.
This error message is generated AFTER later code has run, as proven by the fact that a later MsgBox call executes before the error message.
I call it a "false error message" because the code still works, deleting the table every time.
There are no other DROP statements involved in any code.
I have no idea where to start looking. Any ideas will be appreciated.
GSerg, thanks. Yes, it is a second, different MsgBox coded after DoCmd.Execute that pops up before the error message. This second msgbox displays the SQL statement for a make-table query which replaces the deleted table, and which is executed without incident. I probably should have mentioned: I am using Windows 10 and Access 2016 in a standalone installation (without the rest of Office). I have had no other strange problems. I have a suspicion this is related somehow to Access inner threading logic. Or maybe it's an Access "ghost" (it wouldn't be my first), which can be eliminated by creating a new blank database and importing everything form the afflicted one so start clean.

Ms-Access Query is getting deleted automatically. What can be the reason?

Some of the queries I have written inside MS-Access are getting deleted automatically. And while I run the queries through code, I get this error:
Query should have one destination field
What can be the possible reason?
Explanation: I created a query in MS-access. Ran it from the code. Closed the database. Started it again, and now for that particular query, it is showing 'SELECT ;'only.
Strange. I am in panic mode now
Check if your query actually has any fields in the query design grid. When you open the query in design view, you will most likely notice it doesn't.
Does the query stick around when you don't run the code (but still close and reopen the database)?
If so, I would suspect that something in your code is overwriting the query.

"DoCmd.OutputTo acOutputQuery" is deleting the query

I'm encountering a problem where DoCmd.OutputTo acOutputQuery deletes the query itself the second time it is run.
Is there any workaround/patch for this bug (at least seems like a bug to me)?
Re: your comment.
Did you do a file copy, or did you copy the objects between two databases? IF the second, you might want to try doing a compact and repair on a file-copy of the original.
You might even want to try that on the real original.
I think the behaviour you described "...deletes the query itself, the second time it is run" occurs when the query returns no records.
even 2007 has this problem, it is happening to me also, but very randomly. Sometimes I can run it many times before the bug happens, other times it happens right away, it's a small database, 29 records, and a tiny query, so it's definitely a bug in access
I know it's been awhile since the original post, but I have found a solution that I did not see here. I'm using Access 2010. It seems that almost everytime I execute DoCmd.OutputTo acOutputQuery..., my saved query still appears in my list of queries, but the SQL gets wiped out, which subsequently deletes my output file too from the network.
I just reset the SQL before calling DoCmd.OutputTo acOutputQuery...
CurrentDb.QueryDefs("MyQuery").SQL = "SELECT..."
and then call
DoCmd.OutputTo acOutputQuery, "MyQuery"...
So far so good.
it happens to me too.
I'm using Access 2003.
The only workaround I've found is to preserve a copy of the original mdb, this way I can restore the mdb when it happens.
It seems that Access 2007 doesn't have this problem.
Another workaround is to change the original query to a make table query, and then use
DoCmd.OutputTo acOutputTable, TableName, ...
It means you have an extra table hanging around, but you could always do a delete table in code or via a query afterwards to clean up.