ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to link to DB to update data? (https://www.excelbanter.com/excel-programming/366380-how-link-db-update-data.html)

doristsr[_3_]

how to link to DB to update data?
 

Hi;

I m new in VBA, can anyone tell me is it possible to use VBA to
update data to a database?

I m actually using a string like below to connect to my db:

Let DSN = Sheets("Settings").Range("B7").Value
strConn = "OLEDB;Provider=MSDASQL.1;Persist Security
Info=False;User ID=ABC;Password=password;Data Source='" & DSN & "'"

if i have a query:
StrSQL = "update table set field1='123' where id = 'abc'"

may i know how to code so that i could execute this StrSQL?

Thanks for your help :)
Doris


--
doristsr
------------------------------------------------------------------------
doristsr's Profile: http://www.excelforum.com/member.php...o&userid=35881
View this thread: http://www.excelforum.com/showthread...hreadid=558721



All times are GMT +1. The time now is 05:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com