Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Broken Trap

Status
Not open for further replies.

Jerz

MIS
Sep 10, 2004
102
US
I have what ought to be a pretty simple trap. It either worked (0), or didn't (any non-zero).

But I'm seeing users on my incoming list with invalid names (smith, Jr.) that should and do fail to create. But when they fail to create, they also fail to set err.number at something else than 0, and my logging process logs them as good, created users.

Code:
err.clear
Set objUser = objOU.Create("User", "cn=" & strCommon & "")
If err.number = 0 then
	objFileRpt.writeline "Created user account UID=" & strUID & " cn=" & strCommon & " " & err.description

Does anyone see something I'm overlooking?
 
What if you tried

If Err.Number = 0 And IsObject(objUser) Then .....

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Actually...you may not get the error until you try objUser.SetInfo so maybe put your error traping after that.

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top