I have the Front_end in the MS-Access and the database is on theserver. Have connected the database with the ODBC connecter.
I have attached the sub-form under the form. and assign the TAb. while adding the new Record, when I clicked on the form it is showing me this error ODBC - insert on a linked table failed. (Error 3155). The error just pops out while clicking every on the table. even when I click on the close button, before closing the window this popup comes ODBC - insert on a linked table failed. (Error 3155). Dont know how to rid off from this trouble shoot.
Important Note:
The Main form has the table linked - tblInvoices ( This table is the parent table of
the tblInvoiceDetails.
SubForm under the main form has the Linked table - tblInvoiceDetails - this table is
linked with the parent table tblInvoices.
When i m entering the some data on main Form, and then press enter to go under Subform
then this popup appears ODBC - insert on a linked table "tblInvoices" failed.
tblInvoices has a large amount of data ~1m rows.
tblInvoiceDetails has a large amount of data ~2M rows.
In tblInvoiceDetails there is the foriegn key which is refer to the tblInvoices
Unique key.
Have Tried:
Have recreated the database with the new tblInvoices and
tblInvoiceDetails with limited rows.
In tblInvoices and tblInvoiceDetails we have added and checked the primary key in each table.
Screen Shots:
If anything you professionals required then please let me know. will share you.
Thank you. for your help.
The error is not with respect to Ms-access its the limitation to ODBC connector.
sql - Issue with ODBC Object connection - Open limitation to 65k rows - Stack Overflow.
Please read : Issue with ODBC Object connection - Open limitation to 65k rows
This works for me:
Older Excel versions (prior to 2007) indeed have a limit of some 65k+
rows per worksheet. Run your code and reference any object Lib
starting w/Excel 2007 and up (max 1,048,576 rows per worksheet, Lib
version correspondingly 12.x and up).
Have Change the Provider = Microsoft.ACE.OLEDB.12.0 with Microsoft.ACE.OLEDB.16.0. Update the lib with the higher version & Latest version.
Thanks.
Related
Everytime I enter data into one of the SQL linked tables, some of the rows keep saying #deleted no matter what I do. The data is fine in the actual SQL server but not within Access. I never have used Access before so I have no idea what I'm doing. Please use the most non-tech savy dialog as possible... This is all so new to me and I am not good with technology at all.
I have tried refreshing the tables by going to the "Linked Table Manager" thing but that hasn't helped. I tried completely deleting the data from both Access and the SQL Server, re-entering it into the SQL server, and creating a new linked table within Access. I have tried exporting the data into Excel from the server and importing it into Access. None of it has worked. It's only the first 10 rows of data though... The rest of the table is completely fine and all the data has similar structure so I don't know why only the first 10 rows are being affected.
Ok, there are 3 things that often cause this.
1 - Make sure the sql table has a PK column. This is often (useally) a autonumber (incrementing by 1 integer column). So when you create the column in sql server, set it as primry key (a button in the menu can be hit to set PK using the sql manager). Then change in the property sheet the column to identify "yes" and it will set the starting number (1) and the increment (1) for you. Now add the other columns.
So Access needs a PK column.
If above was not your issue, then next up that is common is if you have a "bit" column in sql eerver. These can't be null, or access goes crazy. so if you have a bit column, then MAKE sure you set the default for that in the sql table designer as (0).
If the above don't fix your issue? Then number 3 on the list is to add what is called a row version column to the sql table. Simply add a timestamp column (this is NOT a date column, but is a time stamp row).
In ALL of the above cases, after you make the change to the sql server table, you have to re-link the access table. It is sufficient to right click on the table in Access, choose linked table manager, and then check box the table in queston, and hit ok. The link will be refreshed for you.
So the above are the 3 main issues. In most cases, the PK is the issue. However, if the table on SQL also has a trigger (that inserts) to other tables, then that table trigger has to be changed - but lets take this 1 step and soluion at a time.
As a general rule, Access needs a PK column when working with sql server. If you have that, then check the null "bit" issue - sql server tables need a default setting of 0 for those columns, and if they are null, then Access don't like that.
If both above issues are NOT your issue, then adding a column of timestamp to the sql table will fix this.
I have in Microsoft Access a linked table to an ASE Server.
On the server side, the table has no primary key or identity columns.
And has a trigger on insert that validates new entries, so that when the entry is not validated it deletes the entry from the table and writes to "table"_ERR to let the users know what error was produced.
When linking it to Access a composite key is created using 10 columns.
I have this same setup in 10 different tables (all with triggers all linked to Access)
In this particular table when trying to insert/append records to the table through Access i always get the error message:
Single-row update/delete affected more than one row of a linked table. Unique index contains duplicate values.
This error occurs when both table and table_ERR are empty and i'm only trying to insert 1 record.
If I disable the trigger i have no problem inserting records through Access
I have similar triggers in other tables that are working correctly.
What can be causing this issue and does anyone know how to solve this?
I have read that MS Access can mess up the ##identity, even so none of the solutions presented online seem to work.
links : https://groups.google.com/forum/#!msg/microsoft.public.sqlserver.programming/McHdRpPKMhs/SlyObU8w7JMJ
Stop Access from using wrong identity when appending to linked table on SQL server
Thanks in advance.
EDIT: if i try to insert the records directly from a management software (like Aqua Data Studio) there are no erros
Without knowing more specifics about your data itself, it is difficult to say why this might be happening.
However, it sounds like in this specific instance for this specific linked table, your 10 columns are not unique enough to prevent non-distinct rows from being selected.
Suggested fixes:
Add a primary key. Honestly, probably the best and easiest choice.
If for some reason you cannot add a new column to (or alter) your table; you may be able to re-link your table, and re-choose your 10 columns so that they are more unique.
Beyond that, I think we would need more information.
Just out of curiousity, what is the reason for having no key?
I have a MS-Access 2010 database that has Sybase tables linked to it through an ODBC named FNA.
I can read from the linked tables just fine, but writing to them is proving to be far more difficult. I am trying to use the below insert into sql to add data from an access table named _ModelVersion to the linked table named DBA__ModelVersion. Sometimes it works for a little while but mainly I get an error that says "ODBC--insert on a linked table 'DBA__Collectors' failed. authentication violation"
strQuery63 = "INSERT INTO [DBA__ModelVersion] ( ID, EDXVersion, template, DatVersion, DbVersion, AccessVersion ) " & _
"SELECT [_ModelVersion].ID, [_ModelVersion].EDXVersion,[_ModelVersion].ProjectTemplate, [_ModelVersion].DatVersion, [_ModelVersion].DbVersion, [_ModelVersion].AccessVersion " & _
"FROM _ModelVersion "
DoCmd.SetWarnings False
DoCmd.RunSQL strQuery63
DoCmd.SetWarnings True
Should some other method be used? Not sure it matters but I have combo boxes that use the linked table as a source and before this query is run a dmax function is used on the linked table in question as well. I read that creating a stored procedure on the sybase database side and calling it from access would be the way to go but I have no idea how to do that, much less get the stored procedure to pull data using the FNA on the Access side.
Edit: So far I have tried:
1) making sure data types from sybase are being shown in access properly (data types in sybase are numberic and varchar and in access they show up as decimal and text which seems to be fine)
2) Adding autoincrement primary key to sybase table and indicating it when linking it into access
3) using currentdb.execute with dbseechanges
4) refreshing the table using the method shown in the accepted answer here
5) Tried adding a field timestamp with the value set to current timestamp. No improvement.
Funcionallity remains the same: The update query will occassionally work, then continue giving "run-time error '3155': ODBC--insert on a linked table failed" which is seen whether I use VBA or query design to run the query.
I've experienced some issues in the past with RunSQL on ODBC linked tables. When dealing with a linked table with a Primary Key, you need to use the dbSeeChanges option.
The error you mention above indicates a table with no primary key set. Right click the table and enter Design view (in MSAccess). Highlight the row you wish to make Primary Key (Unique Identifier). Click the button with the gold key icon.
Try UPDATE/INSERT with the following...
CurrentDb.Execute "INSERT INTO tblYourTableName VALUES ('YourTextValue',123)", dbSeeChanges
Substitute your table/columns/values.
We have been using a Delete command on Access 2003 with xp machine from past few years and it was working good until we upgraded our systems to Access 2010 and Windows 7.
Please see the error below. No sure what i was missing. I tried creating a new link oracle table, but it didn't work.
I just ran into the same lock error when trying to update a linked SQL Server table via MS Access 2010.
This may no longer be a problem for you since the thread is so old, but hopefully it makes it easier on someone else in the future.
I was able to fix it by changing the ID field in SQL Server from a bigint to an int.
You may also want to make sure that "Default record locking" is set to "No locks" in Access Options --> Client Settings --> Advanced
DefaultRecordLocking http://www.tmetrics.net/support/patrick/stackoverflow/defaultrecordlocking.jpg
I had this error with a linked table that had a primary key and a unique key. When linking the table, Access assumed the unique key was the primary key.
By temporarily disabling or deleting the unique key and refreshing the ling using Linked Table Manager" the problem was resolved.
It appears that the 332 records it can't delete are locked, perhaps by some other process? Is there a stagnant process running somewhere that is holding a lock on those records?
I had a similar problem... Could delete records manually, but through query was getting that message.
Even though I was deleting records in the "many" table in a one-to-many relationship, a "key violation" message kept appearing.
I edited the relationship to ADD Cascade Update and Cascade Delete, and the problem went away.
I am having this problem. I have an Access front-end to an Oracle database. I am trying to delete records from a linked table. I have not found a solution anywhere on the internet. Here is my "solution".
I converted from DoCmd.RunSQL to DBS.Execute to run my Delete query. That got rid of the error message. But not all records were being deleted still. So now I execute the delete query in a loop.
recCount = DLookup("count(*)", "my_table")
Do While recCount > 0
DBS.Execute "DELETE * FROM my_table", dbSeeChanges
recCount = DLookup("count(*)", "prod_nmpsia_premiums")
Loop
Sometimes it only takes one pass. Other times it takes a few.
I know it's a kludge. But it works.
I was running into this same issue using Access 2016 and an Oracle database. I could append to the Oracle tables just fine, but when I ran the delete query to remove those same records, it would delete some records and say others were locked. If I looped the query enough times it would eventually erase all the records.
The solution I found was in the Access delete query, I set the 'Use Transactions' property to 'No' and it started working fine without any record locks. I don't know if this is a perfect solution, but it is working in my case.
--Update--
The above solution worked for some of my queries but then I still ran into the issue on other queries. So it helped in some cases but didn't work completely.
What does seem to be working now is that I stored a Procedure in Oracle that would delete the data I needed to delete and I am calling that procedure from Access.
Ok. Quick background:
MS Access 2003 with 2003/2003 format MDB file upgraded from Access 97.
For the purposes of this example, there are two tables.
Table 1
Asset
ID - (text 20)
ParentID - (text 20)
Other fields
AssetRels
ID - (text 20)
When a record is added to Asset, the ID is added to AssetRels.
From Asset.ID to AssetRels.ID there is a relationship that exists that enforces referential integrity with cascade update and cascade delete.
From AssetRels.ID to Asset.ParentID there is a relationship that enforces referential integrity with cascade update only.
I have 2 records in Asset
VACU0703200, NULL
VACU0703250, VACU0703200
In the data DB, I can go into the table and change VACU0703200 to VACU0704500 and the changes propogate as expected.
If I open the front end DB that links to the data DB, and try the same change (in the table directly) I get "Could not update; currently locked" (no, nothing about 'another session', that's the whole error message)
Both databases are set to "no lock" for the "default record locking"
Obviously, there is some difference in row/page/table level locks that is preventing the cascade update from working.
Does anyone know of some property settings that I can use somewhere to stop this error?
I would prefer not to have to remove the relationship, but otherwise I might have to, and handle it in code.
Edit: Cause is that the table contains a Memo field. Apparently via the linked table, having the Memo field overflow the 4K row size escalates to a table lock. which in turn triggers the problem.
Solution (hackish) is to prevent edits to the ID field on the form, and add a new form to rename. Save changes before opening the new form, and performing the update via an update query works.
I don't see why moving to the front end and editing this from a linked table should make any difference. I would however delete the table links, and then RE link. Often sometimes some properties are set up and read a time of linking, if you go to the back end database and change some of the table properties, often it's a very good idea to RE link the tables.
As a general rule, you more often have to do the above when you add new columns with linked tables to SQL server. However, I would suggest you delete your linked tables in the front end, and try RE linking, this should fix this problem.
Solution (hackish) is to prevent edits to the ID field on the form, and add a new form to rename. Save changes before opening the new form, and performing the update via an update query works.
The cause is a table lock escalation that occurs when the text overflows the 4K table row limit.