Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Updating Table uses old data from Linked Table


Updating Table uses old data from Linked Table

Author
Message
db8s77
db8s77
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 49
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.
jamescox
jamescox
Grasshopper
Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)

Group: General Forum Members
Points: 10 Visits: 453
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!
WendellB
WendellB
SSC Veteran
SSC Veteran (247 reputation)SSC Veteran (247 reputation)SSC Veteran (247 reputation)SSC Veteran (247 reputation)SSC Veteran (247 reputation)SSC Veteran (247 reputation)SSC Veteran (247 reputation)SSC Veteran (247 reputation)

Group: General Forum Members
Points: 247 Visits: 1632
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!
db8s77
db8s77
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 49
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search