Question : ADODB.ActiveConnection error

In Access 2003 VBA, I'm trying to code the deleting of a record using an adodb connection.
I have this ccode:

Global Const sconnecttest = "ODBC;DRIVER=SQL Server;SERVER=Pauljmcneil;APP=Microsoft Office 2003;" _
  & "WSID=PAULJMCNEIL;DATABASE=jjtptab13SQL;Trusted_Connection=Yes"

Dim cmd As New ADODB.Command
Dim cnn As New ADODB.Connection
 
  sql = "DELETE FROM dbo.tblCustomer WHERE dbo.tblCustomer.CustomerID=23283"
  Set cmd = New ADODB.Command
  cnn.ConnectionString = sconnecttest & ";TABLE=dbo.tblCustomer"
  cmd.ActiveConnection = cnn.ConnectionString
  cmd.CommandText = sql
  cmd.CommandType = adCmdText
  cmd.Execute

I get the following error on the line:
cmd.ActiveConnection = cnn.ConnectionString

"Data source name not found and no default driver specified"
Thanks

Answer : ADODB.ActiveConnection error

PAQed with points refunded (500)

Computer101
EE Admin
Random Solutions  
 
programming4us programming4us