Updating Table uses old data from Linked Table

  • Process :

    Table A is a table internal to Access 2007.

    Table B is a linked table in Access 2007 to SQL Server 2012.

    In Access VBA, have a module that does the following steps:

    1. Call a DTSX that updates Table B

    2. VBA code calls an update query (DoCmd.OpenQuery) that is supposed to update Table A's flag with Table B's flag.

    Issue: the update query is using Table B's values prior to the DTSX update.

    If I rerun the update query, I get the correct values.

    I need to have Table B values to be the most current values before update.

    Any help is appreciated.

  • Possible quick fix would be to add a DoEvents statement between the update and where you read from the (hopefully) updated table.

    Another outside possibility would be to use shell to do the update and wait until the shell command returns a value before continuing to the point where you need to read. A Do-While loop with a DoEvents statement might serve to delay forward progress through your code until the update completes.

    Good luck, and be sure to post back what worked!

  • A bit late to the party, but wanted to point out that the future of DTSX files is somewhat cloudy - see Data Transformation Services (DTS) for warnings on it. I would look at alternatives for updating the data. Also, the idea of having a local Access table that mirrors data in SQL Server seems a bit problematic - in general you get as good or better performance using the linked SQL Server table data, or a linked SQL Server view if you only want selected fields and data.

    Wendell
    Colorful Colorado
    You can't see the view if you don't climb the mountain!

  • Thanks for the responses.

    After further development, we changed the set up in Access to just have a linked table to SQL Server that has all the data updated. I still call the DTSX (not DTS) that was created with SSIS from within Access VBA code to start the update on the server side.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply