R
robboll
Hello Developers!
I am trying to capture some field values from a SQL Server 2008
database in some Outlook VBA. When I step through the code with the
debugger it seems to connect fine, and the strSQL variable displays
the select statement correctly. The problem is the variables mtid and
mpath come out null. I need to capture mtid and mpath from the select
statement. Do you have any suggestions on how I should do this? I've
had a lot of variations of this code, and this one seem to perform the
best. Thanks for any help with this!
RBollinger
Function test4()
Set strConnection = CreateObject("ADODB.Connection")
strConnection.Open ("Provider=SQLOLEDB;Data
Source=ULDSV02;Database=WeeklyReport;Trusted_Connection=Yes;")
Set rs = CreateObject("ADODB.Recordset")
strSQL = "SELECT [TopicID] as mtid,[Path] as mpath FROM [WeeklyReport].
[dbo].[uvw_TIDPath] WHERE rtrim([TopicID]) ='520';"
rs.Open strSQL, strConnection
strConnection.Close
Set rs = Nothing
Set strConnection = Nothing
End Function
I am trying to capture some field values from a SQL Server 2008
database in some Outlook VBA. When I step through the code with the
debugger it seems to connect fine, and the strSQL variable displays
the select statement correctly. The problem is the variables mtid and
mpath come out null. I need to capture mtid and mpath from the select
statement. Do you have any suggestions on how I should do this? I've
had a lot of variations of this code, and this one seem to perform the
best. Thanks for any help with this!
RBollinger
Function test4()
Set strConnection = CreateObject("ADODB.Connection")
strConnection.Open ("Provider=SQLOLEDB;Data
Source=ULDSV02;Database=WeeklyReport;Trusted_Connection=Yes;")
Set rs = CreateObject("ADODB.Recordset")
strSQL = "SELECT [TopicID] as mtid,[Path] as mpath FROM [WeeklyReport].
[dbo].[uvw_TIDPath] WHERE rtrim([TopicID]) ='520';"
rs.Open strSQL, strConnection
strConnection.Close
Set rs = Nothing
Set strConnection = Nothing
End Function