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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetDocumentByKey not working - please help!

Status
Not open for further replies.

Pamy

MIS
Oct 15, 2002
29
SG
I'm trying to retrieve userprofile form that matches the email of the current document. If there is no matching email, the system should be able to display a blank form.Below is the coding.
However, the code always run to
Set uidoc = ws.ComposeDocument("","","UserProfile")
even though i know there is matching email found.

==========================================
Dim s As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim ws As New NotesUIWorkspace
Dim Email As String

Set uidoc = ws.CurrentDocument
Email= uidoc.FieldGetText( "text" )

Set db = s.CurrentDatabase
Set view = db.GetView("UserProfile")
Set doc = view.GetDocumentByKey(Email)

If doc Is Nothing Then
Set uidoc = ws.ComposeDocument("","","UserProfile")
Else
Set uidoc = ws.EditDocument(True,doc)
End If
 
Hi,

At first glance the code looks OK.
So we need to take a look at the key..

Have you checked that the FIRST column in the view "UserProfile" is sorted AND contains the field you are looking for? If not, the lookup will fail.

You can also let a MSgbox display the "Email" variable to take a look if the key is retrieved correctly. Maybe you will need to trim to get rid of spaces or so.



Kind regards,

Dominik Malfait
dominik@amazingit.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top