newsvr = Space$(CNLEN + 3) ' must be big enough to contain domain name
Do
result = NetGetDCName(svr, CurrentDomain, ByVal newsvr, Len(newsvr))
If result <> 0 Then
If CurrentDomain <> LogonDomain Then
ErrMsg$ = "Error retrieving domain controller for domain " + CurrentDomain + ". Domain name will be set to the logon domain " + LogonDomain + "." + Chr$(13) + Chr$(13)