Problem getting documents with GetDocumentbykey

I have an agent that looks at two separate databases on the same server for a user name. Basically if the user is not in the first db view it moves to the second one and checks. The first db has been used for a while and I have no problem when the user is in the that db, however if the user is in the second db the agent can not find them. I have checked the view and it is indexed and the documents are there just not being found. Here is some of the code:

Set doc = view.GetDocumentByKey(user,True)

If doc Is Nothing Then

Set doc2 = view3.GetDocumentByKey(user,True)

If doc2 Is Nothing Then

Print “Error !! Document Not Found In The Associate or The Affiliate Database.”, (Trim(user))

End If

End If

I am not sure if this is a problem with the code or with the second database, which is new. Has anyone run into this, am I missing something with the access control or something that I am not thinking of, no matter what view in the second database I use it does not find the docs. Any help would be great, thanks in advance.

Subject: Problem getting documents with GetDocumentbykey

Hi

Are you absolutely sure that the second view has its first column sorted,

and that it is the same name format that you are looking for ?

ian

Subject: Problem getting documents with GetDocumentbykey

Hi Brett,

The problem looks a bit confusing and critical. Any how, you can use GetEntryByKey instead GetDocumentByKey. Ofcourse “Dim entry As NotesViewEntry” must be declared earlier. I am not sure, but you can give it a try.