MS Access linked table to SQL Server update record - database

I have a table in SQL Server 2012 (Table1) and I have created an MS Access 2016 database and then created a linked table in MS Access to Table1 in SQL Server 2012 using a System DSN.
This works fine, I can open the linked Table1 in MS Access 2016 see the columns and update the values. I have then created a Form in MS Access 2016, added the columns from Table1 to the Form and I can see the data fine.
The problem I have is that the option to Add New Record is greyed out and no matter what I try I cannot add a new record to Table1 using the Form.
If I create a standard (not a linked table) in MS Access 2016 and add the columns to the Form rather than the columns from the Linked Table1 the Add New Record icon is then available.
My question is... Is it possible to use a Form in MS Access 2016, have the data source as a Linked Table to a table in SQL Server 2012 and add new records to it? (And if so, how do I achieve this as I've been at this now for hours and hours and cannot figure it out).
Many thanks in advance.

You note that you can update values when you click on the linked table and view the rows.
Can you ADD rows when using that linked table? And if you cannot, then open up the table using SQL Management Studio and try adding rows that way?
If you don’t have correct (or any) settings in SQL server that sets up or increments the primary key, then you can’t add rows (automatic in this context).
So make sure the table has a primary key, make sure you can add rows using SSMS. If you make changes to fix this SQL table, then you have to re-link the table.
I suggest you create a primary key in the SQL table, and make it a identity column with a increment of 1.

It is certainly possible; this is a very common approach. It sounds like the login you used in the System DSN to connect to SQL Server does not have INSERT permissions on the table. Are you able to review the permissions to check that?

The auto-insertion/update doesn't work for link-database. You need to write a VBA code behind your interface.
Below solution can give you a basic and simple heads up:
Inserting into SQL Server using MS Access

Have a similar situation. Linked Sql Server table, Access Form front end. I am able to insert/update/delete via the form. However, I then created a checkbox to implement a filter on the data. When the box is not checked, I can still edit the data. However, as soon as I check the box to activate the filter, I can no longer insert/update/delete. When I uncheck the box, I can again edit the data. So in my case, the problem is due to the filter, which is implemented via a VBA query involving both an outer join and a union. The query replaces the form's control source when activated, and I believe it is simply too complex for Access to treat it as updatable.

Related

Ms Access with a linked SQL Server

I have MS Access which is linked to SQL Server
I'm typing on a keyboard with Kurdish Central layout.
Data in SQL Server is no problem, but in MS Access it's showing a column as
#Deleted
This problem is only in Kurdish.
What is the solution to this problem?
Thanks for everything ...
I don't believe this has ANY relevance in regards to the language used.
Make sure the server table has a PK id, and also add a row version column to the sql server table. (row version is called timestamp - but has ZERO to do with time - worlds worst name in history for a column type in sql server).
So, ensure the sql table has a PK column defined, and also that timestamp column. Now, rel-link the access table and try again.

simplest way to permit end user edit one table with a grid?

I have one table (could be more in future) in database and want to user edit the values in this table. (without access to SQL studio.)
I was trying excel - but it is possible by SSIS which is not immediate or needs programing. SQL 2016 permit to use excel files as external table but i have previous version of SQL.
In MS Access i remember was possible to connect to sql server, just create form and insert grid to edit. But Access cost.
So are there any free solution just give possibility to edit values in one table from server?

Added Colums in table of SQL not showing in Access

I am working on SQL Server Management Studio 2012 where my database is situated, but my operating system runs on Access itself which is linked to SQL server. I have inserted some columns into a table on SQL, but when I want to add these fields into my existing Access report, these new columns does not show on the available fields to insert, although they do on SQL. What am I doing wrong or not doing?
What you miss is to relink the table in Access.
This will update the Fields collection.

How to reorder and add columns on specific position in SQL Server 2008 R2?

I wants to build the tool to reorder the fields of already exist table with data in SQL Sever 2008 R2. Also I want to create a logic to add a column in any specific position. In Mysql or firebird they have the options and TSQL queries to do that.Any body please share whether we have that options in SQL Sever 2008 R2. If any smart logic available means share it to me. Thanks in advance.
Re-ordering the columns of an existing table is going to be a costly process. The table will have to be rebuilt from scratch. SQL does this for you by creating a copy of the table using the new order and then inserting the existing data into that table. Once this is done, the initial table is dropped and the new one put back in place.
A better solution would be to use a VIEW. They can be changed at will.

MS Access shows #deleted, although data is saved correctly

We have an MS Access 2007 database with a MS SQL Server 2008 backend.
On the server, for each table, we have written a view, and each view contains triggers for update/insert/delete. These views are then linked into MS Access as linked tables.
Every server table contains a primary key consisting of one or more columns, plus a separate IDENTITY column (int, with unique index).
Now, if I go into MS Access and enter data directly into the linked table, everything works fine.
But if I create a Form, which uses the linked table as recordsource, then after each insert, all fields show #deleted. However, the data is stored correctly into the database, so it is mainly a display problem!
I think this has something to do with the triggers, but I cannot find the problem.
Can anyone help on this problem?
Problem solved. There was actually a problem in the trigger, which caused more than row to get updated or inserted. After fixing the trigger, everything works now.

Resources