Tuesday, March 6, 2012

"Object is required" (DMO) ?

Dear all,
are you seeing something weird here?
Dim oServer As SQLDMO.SQLServer2
'Dim oServer As SQLDMO.SQLServer2
For Each oServer In oApplication.ListAvailableSQLServers
Debug.Print oServer.Name
Next
This snippet fails.
Let me know where failing is any clue...
Please post DDL, DCL and DML statements as well as any error message in
order to understand better your request. It''''s hard to provide information
without seeing the code. location: Alicante (ES)sorry for bothering
For i = 1 To oApplication.ListAvailableSQLServers.Count
Debug.Print oApplication.ListAvailableSQLServers.Item(i)
Next
Please post DDL, DCL and DML statements as well as any error message in
order to understand better your request. It''''s hard to provide information
without seeing the code. location: Alicante (ES)
"Enric" wrote:

> Dear all,
> are you seeing something weird here?
> Dim oServer As SQLDMO.SQLServer2
> 'Dim oServer As SQLDMO.SQLServer2
> For Each oServer In oApplication.ListAvailableSQLServers
> Debug.Print oServer.Name
> Next
> This snippet fails.
> Let me know where failing is any clue...
> --
> Please post DDL, DCL and DML statements as well as any error message in
> order to understand better your request. It''''s hard to provide informati
on
> without seeing the code. location: Alicante (ES)|||ListAvailableSQLServers returns a NaneList object, not a SQLServer
collection. Try something like:
Dim Name As String
For Each name in oApplication.ListAvailableSQLServers
Debug.Print name
Next name
Hope this helps.
Dan Guzman
SQL Server MVP
"Enric" <vtam13@.terra.es.(donotspam)> wrote in message
news:FE7AF93D-0E90-4C6F-AF11-FC5DDD846BDB@.microsoft.com...
> Dear all,
> are you seeing something weird here?
> Dim oServer As SQLDMO.SQLServer2
> 'Dim oServer As SQLDMO.SQLServer2
> For Each oServer In oApplication.ListAvailableSQLServers
> Debug.Print oServer.Name
> Next
> This snippet fails.
> Let me know where failing is any clue...
> --
> Please post DDL, DCL and DML statements as well as any error message in
> order to understand better your request. It''''s hard to provide
> information
> without seeing the code. location: Alicante (ES)

No comments:

Post a Comment