So I have this cute daisy chain:
Although parts work individually, I can't update the Azure table from Access.
The connection between the databases work properly individually. I can update tblAzure by inserting values into vwSQL. I can also update tables in SQL server via linked Access tables, or even tables by creating a view to them and linking Access to that view. I can also see the values in tblAzure through vwSQL opened in Access as a linked table.
This is the error I get back when I try to update or append the linked view:
ODBC--insert on a linked table 'tblAccess' failed.
[Microsoft][ODBC SQL Server Driver][SQL Server]OLE DB provider "SQLNCLI11" for linked server "azw" returned message "The parameter is incorrect:.".(#7412)
[Microsoft][ODBC SQL Server Driver][SQL Server]OLE DB provider "SQLNCLI11" for linked server "azw" reported an error. One or more arguments were reported invalid by the provider. (#7399)
[Microsoft][ODBC SQL Server Driver][SQL Server]The operation could not be performed because OLE DB provider "SQLNCLI11" for linked server "azw" was unable to begin a distributed transaction. (#7391)
Anyone seen anything like this? I tried changing the link properties/Server Options / Distributor to True, it didn't help.
The basic idea is that I need a table that is perfectly synced in both our databases, and one that can be edited by our users in Access. (Don't ask, I inherited a way too overcomplicated system...)
Test scripts
In Azure:
CREATE TABLE [dbo].[AzureTable](
[AzureTableID] [int] NOT NULL,
[SomeText] [nvarchar](50) NULL,
CONSTRAINT [PK_AzureTable] PRIMARY KEY CLUSTERED ([AzureTableID] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
)
GO
INSERT dbo.AzureTable VALUES (1, N'Hello')
In SQL Server:
(AZW is the name of the linked Azure server, HUFU is the DB)
CREATE VIEW dbo.SQLServerView
AS
SELECT *
FROM AZW.HUFU.dbo.AzureTable
GO
INSERT INTO dbo.SQLServerView values (2,'working')
This is working too.
In Access, I link the view (I have many other linked tables and views, they all work). Opening the Access linked table (pointing to the SQL server view) it shows the data, but can't save the modifications, displaying the above mentioned error.
I actually have a workaround now, but this thing is bugging me, I'd love to understand what's wrong here...
Edit a data sourceIn the Linked Table Manager dialog box, select the data source, hover over the data source, and then select Edit. Change the information in the Edit Link dialog box. Select Finish.
Yes it is possible because view is a virtual table and can deleted,inserted and updated. View are virtual tables that are compiled at runtime. Data associated with the views are not physically stored in view, they are present in base tables.
Open the database that contains the records you want to update. On the Create tab, in the Queries group, click Query Design. Click the Tables tab. Select the table or tables that contain the records that you want to update, click Add, and then click Close.
I am not sure this will apply to your case but the last time I was unable to update an SQL Server View from MS Access the solution was to make sure the Access linked table that represented the view had a primary key.
This is what I use to create the PK:
CurrentDb.Execute "CREATE INDEX __uniqueindex ON [" & TableName & "](" & PKFieldName & ")"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With