?
Solved

Problem using GetObject("WinNT:")

Posted on 2004-08-27
2
Medium Priority
?
1,893 Views
Last Modified: 2006-11-17
I'm currently using the following code to get a listing of all the domains in my LAN. It works fine, but every once in a while, GetObject returns nothing, and I have to recursively call the same routine untill it returns data. I'm confused as to why this is happenning. Can someone help?

Here is the code:

 Dim objNS As IADsContainer
 Dim objDomain As IADs
   
   Set objNS = GetObject("WinNT:")
 
   For Each objDomain In objNS
      cmbDomain.AddItem objDomain.Name
   Next
   
   MsgBox cmbDomain.ListCount
   
   If cmbDomain.ListCount = 0 Then
      Call Form_Load
   End If


* This is an extension of the following question :
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21004965.html
0
Comment
Question by:LeeHenry
2 Comments
 
LVL 1

Accepted Solution

by:
mkrell earned 2000 total points
ID: 11927010
maybe this is because of a timeout while getting the object...

use:

Do
   Set objNS = GetObject("WinNT:")
Loop until  not (objNS Is Nothing)

instead of your recursive way.
0
 
LVL 6

Author Comment

by:LeeHenry
ID: 11931107
Thanks for the response. I'll give this a try this afternoon.

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question