trackdaychamp
Access Guy
- Local time
- Today, 14:44
- Joined
- Jan 22, 2007
- Messages
- 26
Hi,
I am using VBA to connect my Access ADP file to SQL Server 2005 Enterprise Edition. Can anyone spot a glaring errors with the following code?
Thanks,
Mark
'Open the connection to the SQL Server DB
Dim cn As ADODB.Connection
Dim strServerName As String
Dim strDbName As String
Dim strProvider As String
strServerName = "DELOITTE-A583B4"
strDbName = "PMO_ADP_Single Connection"
strProvider = "sqloledb"
' Specify the OLE DB provider.
cn.Provider = strProvider
With cn
' Set SQLOLEDB connection properties.
.Properties("Data Source").Value = strServerName
.Properties("Initial Catalog").Value = strDbName
.Properties("User Name").Value = "PmoLogin"
.Properties("Password").Value = "1234"
End With
cn.Open
I am using VBA to connect my Access ADP file to SQL Server 2005 Enterprise Edition. Can anyone spot a glaring errors with the following code?
Thanks,
Mark
'Open the connection to the SQL Server DB
Dim cn As ADODB.Connection
Dim strServerName As String
Dim strDbName As String
Dim strProvider As String
strServerName = "DELOITTE-A583B4"
strDbName = "PMO_ADP_Single Connection"
strProvider = "sqloledb"
' Specify the OLE DB provider.
cn.Provider = strProvider
With cn
' Set SQLOLEDB connection properties.
.Properties("Data Source").Value = strServerName
.Properties("Initial Catalog").Value = strDbName
.Properties("User Name").Value = "PmoLogin"
.Properties("Password").Value = "1234"
End With
cn.Open