I am trying to update one single record each in a main form and subform to online SQL tables.
I have two append quries that are connected to a form, the main form also includes a subform.
I will explain the structure of my tables.
Local tables:
Contacts (PK=ID)
Actions_local(PK=AID, FK=ID)
Online SQL Server tables:
dbo_Contacts (PK=ID)
dbo_Actions_local(PK=AID, FK=ID)
Masterform (Contact Details)
Subform in Contact Details (frmActions)
I am able to update the main form with a append query to the online SQL Server table, but not the subform.
The sql for the main form is
Code:
INSERT INTO dbo_Contacts ( ID, FirstName, LastName )
SELECT Contacts.ID, Contacts.FirstName, Contacts.LastName
FROM Contacts
WHERE (((Contacts.ID)=[Forms]![Contact Details].[ID]));
The sql for the subfrom is
Code:
INSERT INTO dbo_Actions_local ( AID, ActionDate, Stock, ID )
SELECT Actions_local.AID, Actions_local.ActionDate, Actions_local.Stock, Actions_local.ID
FROM Contacts INNER JOIN Actions_local ON Contacts.ID=Actions_local.ID
WHERE (((Actions_local.AID)=[Forms]![Contact Details]![frmActions].[Form]![AID]) AND ((Actions_local.ID)=[Contacts].[ID]))
Both queries are executed with the same event with each OpenQuery action in a macro for the On Click event of a button