Updates Personel Data In Nab From Another Database

Updates Personel Data In Nab From Another Database

Updates the general fields (phone, adress extra) in the Notes Address Book from
a Human Resource DB or any other DB.
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim s As New NotesSession
Dim coll As NotesDocumentCollection
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim Item As NotesItem
Dim compare As NotesItem
Dim db As NotesDatabase
Dim db2 As NotesDatabase 'Current database
(HR)
Dim doc As NotesDocument
Dim doc2 As NotesDocument 'Current Form
Dim dateTime As New NotesDateTime( "" )

Set db2 = s.CurrentDatabase 'To Define The Server
Set db = New NotesDatabase ("server","names.nsf") 'Address Book on
server
'Set db = New NotesDatabase ("","testnames.nsf") local Adress
book

Set uidoc=workspace.CurrentDocument
Set doc2=uidoc.Document


sFirstName$ = doc2.FirstName(0)
sLastName$ = doc2.LastName(0)
'sStatus$ = doc2.Status(0)

If doc2.Status(0)<>"Active" Then
Exit Sub
End If

selection$ = "@If(Form = ""Person"" & FullName=""" + sFirstName$ & " " &
sLastName$ +""")"
Set coll = db.Search( selection$, dateTime, 1 )

Set doc = coll.GetFirstDocument

If (doc Is Nothing ) Then
Messagebox "Employee does not exist in Address Book !!!!"
Exit

    Requires Free Membership to View

    Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.

    By submitting your registration information to SearchDomino.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDomino.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

Sub
End If

'Updates Parameters from HR to the NAB:
' Group -> Dep.
' Manager -> Manager
' Job Title -> Job Title
' Location -> Location


Set item = doc2.GetFirstItem( "Group" )
Set compare = doc.GetFirstItem("Department")
If Not item.Contains( catagory ) Then
doc.Department=doc2.Group
Call doc.save(True,False)
End If

Set item = doc2.GetFirstItem( "JobTitle" )
Set compare = doc.GetFirstItem("JobTitle")
If Not item.Contains( catagory ) Then
doc.JobTitle=doc2.JobTitle
Call doc.save(True,False)
End If

Set item = doc2.GetFirstItem( "Manager" )
Set compare = doc.GetFirstItem("Manager")
If Not item.Contains( catagory ) Then
doc.Manager=doc2.Manager
Call doc.save(True,False)
End If

Set item = doc2.GetFirstItem( "Location" )
Set compare = doc.GetFirstItem("Location")
If Not item.Contains( catagory ) Then
doc.Location=doc2.Location
Call doc.save(True,False)
End If




End Sub

This was first published in November 2000

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.