View Single Post
  #2 (permalink)  
Old 06-01-02, 00:43
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
While in vba go to tools -> references. Add the MS activex data objects library.

Dim rst As ADODB.Recordset
Dim Cnxn As ADODB.Connection
Dim strCnxn As String
Dim strSQL As String

' Open connection
Set Cnxn = New ADODB.Connection
strCnxn = "Provider=sqloledb;Data Source=MyServer;Initial Catalog=mytable;User Id=sa;Password=; "
Cnxn.Open strCnxn

Set rst = New ADODB.Recordset
strSQL= "your update statement"
rst.Open strSQL, Cnxn, adOpenDynamic, adLockOptimistic, adCmdText

Cnxn.Close
Set rst = Nothing
Set Cnxn = Nothing

Last edited by rnealejr; 06-01-02 at 00:47.
Reply With Quote