ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SQL question (https://www.excelbanter.com/excel-programming/354752-sql-question.html)

wana be xl master

SQL question
 
Is there anyway Excel VBA can communicate with SQL database for updating
records?

Would appreciate any help and directions.

Thanks


RB Smissaert

SQL question
 
Sure you can.
Look here to get started:
http://www.jsgrant.com/tutorials/ado/

RBS

"wana be xl master" wrote in
message ...
Is there anyway Excel VBA can communicate with SQL database for updating
records?

Would appreciate any help and directions.

Thanks



Jim F

SQL question
 
Sub SqlUpdate()
Dim rst As New Recordset
Dim SQLcmd As String

SQLcmd = "Insert into myTable (Field1,Field2) values('Value1','Value2')"
''"Update myTable values('Value1','Value2') where PrimaryKey =
'ID'"

rst.Open Source:=SQLcmd, ActiveConnection:="Provider=SQLOLEDB;Data
Source=Your_Server_Name;Initial Catalog=
Your_Database_Name;UserId=Your_Username;Password=Y our_Password;"

End Sub

"wana be xl master" wrote:

Is there anyway Excel VBA can communicate with SQL database for updating
records?

Would appreciate any help and directions.

Thanks



All times are GMT +1. The time now is 08:21 AM.

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