Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-31-2018, 11:47 PM
ArviLaanemets ArviLaanemets is offline Converting a Select statement in Excel to an update statement Windows 8 Converting a Select statement in Excel to an update statement Office 2016
Expert
 
Join Date: May 2017
Posts: 949
ArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant future
Default

Full Update of one table based on another table need up to 3 steps:
1. A delete query to remove records not present in source table from target table;
2. An update query to update all remaining records in target table with info from matching records in source table;
3. An insert query to add into target table records present in source table and missing in target table.

Or you simply clear all info from target table, and insert it anew from source table. In case you have backend database in SQL server, it will something like
Code:
DELETE * FROM TargetTable
 
INSERT INTO TargetTable
SELECT * FROM SourceTable
NB! As you link the Excel table into FrontEnd, the easiest way to run the insert query will be in front-end too. You update SQL Server database table linked into front-end with new data.

NB! When your database is multi-user one, you may have locking problems when you want to update the whole table in back-end, and there are several users using the app at same time.



You can also update the table in SQL Server running a stored procedure in SQL server. The stored procedure reads data directly from Excel table, and updates the info in SQL Server Database table with it. You can call the stored procedure from your Access front-end using a pass-throw query, or you can set up a job, which runs the procedure on schedule.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
EXCEL IF STATEMENT Help bksmith Excel 3 07-27-2021 07:01 AM
Directional help in constructing an Excel 2016 If, Or, And Then Formula Statement Gwilson Excel 3 04-13-2017 11:31 AM
Help! figuring if statement with 2 vlookups excel 2013 MWATKINS7111 Excel 3 02-24-2017 12:58 AM
select statement in macro Nicolette Excel 1 11-19-2013 01:38 AM
Converting a Select statement in Excel to an update statement Select statement to a new document ishaw Word 1 10-17-2011 02:23 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft