Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Updating Table uses old data from Linked Table Expand / Collapse
Author
Message
Posted Thursday, July 24, 2014 9:37 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, August 4, 2014 7:35 AM
Points: 3, Visits: 38
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.
Post #1595941
Posted Friday, July 25, 2014 3:52 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Today @ 6:51 AM
Points: 6, Visits: 333
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!
Post #1596429
Posted Saturday, August 2, 2014 7:54 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 7:44 AM
Points: 149, Visits: 548
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!
Post #1598935
Posted Monday, August 4, 2014 7:46 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, August 4, 2014 7:35 AM
Points: 3, Visits: 38
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.
Post #1599260
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse