Hi,
I'm trying to update a linked SQL Server table whenever data is appended to an Access table in a linked back end. I setup an after insert data macro over the table to call a saved query, but I couldn't get this to work.
After researching online I found that others had achieved what I was aiming to do by setting the data macro to call a function (using the SetLocalVar macro action), into which they pass a key value from the appended record. This function then executes a query built as a variable string, using the key value in its criteria.
I've set this up and it is working fine. So when I write to my linked Access table, the trigger is fired, the function called with the key value as a parameter, the query is run and the relevant record in my linked SQL Server table is successfully updated.
The scenario I'm struggling with is when multiple records are appended to my Access table. When I append two records simultaneously, the trigger is fired once and my function is called once, with the key value of the first record only in its parameters. This function then builds the query string using the value of the first record, updates the relevant record in the SQL Server table for that record, but not the second one.
Does anyone have any suggestions on how to get this working? It's almost like I want to run the macro action for each record in that append action that has called the trigger to fire. But I don't know how. Please help!
Thanks,
Matthew
I'm trying to update a linked SQL Server table whenever data is appended to an Access table in a linked back end. I setup an after insert data macro over the table to call a saved query, but I couldn't get this to work.
After researching online I found that others had achieved what I was aiming to do by setting the data macro to call a function (using the SetLocalVar macro action), into which they pass a key value from the appended record. This function then executes a query built as a variable string, using the key value in its criteria.
I've set this up and it is working fine. So when I write to my linked Access table, the trigger is fired, the function called with the key value as a parameter, the query is run and the relevant record in my linked SQL Server table is successfully updated.
The scenario I'm struggling with is when multiple records are appended to my Access table. When I append two records simultaneously, the trigger is fired once and my function is called once, with the key value of the first record only in its parameters. This function then builds the query string using the value of the first record, updates the relevant record in the SQL Server table for that record, but not the second one.
Does anyone have any suggestions on how to get this working? It's almost like I want to run the macro action for each record in that append action that has called the trigger to fire. But I don't know how. Please help!
Thanks,
Matthew