Solved

Trouble updating values.

Posted on 2008-10-20
3
247 Views
Last Modified: 2013-12-18
I have the code below in a record, how can I fix the last 2 lines of code so it updates the values of the currently open record as indicated.
Sub Click(Source As Button)

	Dim s As New NotesSession

	Dim w As New NotesUIWorkspace

	Dim db As NotesDatabase

	Dim v As NotesView

	Dim c As NotesDocumentCollection

	Dim doc As NotesDocument

	Dim key As String

	Dim cur As NotesDocument

	Set db = s.CurrentDatabase

	Set doc = w.CurrentDocument.Document

	key = doc.ussales(0)    'get the name of office (view category) from the current document

	Set v = db.GetView( "newsletter" ) 'maybe you'll have to create the view that is categorized by office

	Set c = v.GetAllDocumentsByKey( key, True )

	Dim newDoc As New NotesDocument( db )

	Dim rt As NotesRichTextItem

	Set rt = newDoc.CreateRichTextItem( "Body" )

	Dim rtsHeader As NotesRichTextStyle, rtsNormal As NotesRichTextStyle

	Set rtsHeader = s.CreateRichTextStyle  

	Set rtsNormal = s.CreateRichTextStyle

	

	rtsHeader.NotesFont = FONT_COURIER   'it's fixed size font, good for tabbed tables

	rtsHeader.FontSize = 12

	rtsHeader.Bold = True

	

	rtsNormal.NotesFont = FONT_COURIER

	rtsNormal.FontSize = 10

	rtsNormal.Bold = False

	

	Call rt.AppendStyle( rtsHeader )

	

	Call rt.AddNewLine( 3 )

	Call rt.AppendText( "Employee #" )

	Call rt.AddTab( 1 )

	Call rt.AppendText( "Current Asset" )

	Call rt.AddTab( 2 )

	Call rt.AppendText( "New Asset " )

	Call rt.AddTab( 2 )

	Call rt.AppendText( "New  Mon Asset" )

	Call rt.AddNewLine( 1 )

	

	Call rt.AppendStyle( rtsNormal )     'The style that would be applied on text bellow header

	

	Set cur = c.GetFirstDocument

	Do Until cur Is Nothing

		Call rt.AddNewLine( 1 )

		Call rt.AppendText( cur.emp_num(0) )

		Call rt.AddTab( 2 )

		Call rt.AppendText( cur.current_asset(0) )

		Call rt.AddTab( 3 )

		Call rt.AppendText( cur.new_asset(0) )

		Call rt.AddTab( 3 )

		Call rt.AppendText( cur.new_mon_asset(0) )

		Call rt.AddTab( 2 )

		Call rt.AppendDocLink( cur, "Link to document " )  'add link to doc to the end

		

		Set cur = c.GetNextDocument( cur )

	Loop

	newDoc.Form = "Memo"

	newDoc.Subject = "IBPC Refresh DLM Update"' + cur.office_num_adjusted

	Call newDoc.Save( True, True )

	newDoc.CopyTo = "Field Technology"

	Call newDoc.Send( True, "Field Technology" )

'	Call newDoc.Send( True, "SBS Asset Management" )

	

	

	

	Dim newDoc2 As New NotesDocument( db )

	Dim rt2 As NotesRichTextItem

	Set rt2 = newDoc2.CreateRichTextItem( "Body" )

	Dim rtsHeader2 As NotesRichTextStyle,  rtsNormal2 As NotesRichTextStyle

	Set rtsHeader2 = s.CreateRichTextStyle  

	Set rtsNormal2 = s.CreateRichTextStyle

	

	rtsHeader2.NotesFont = FONT_COURIER   'it's fixed size font, good for tabbed tables

	rtsHeader2.FontSize = 12

	rtsHeader2.Bold = True

	

	rtsNormal2.NotesFont = FONT_COURIER

	rtsNormal2.FontSize = 10

	rtsNormal2.Bold = False

	

	Call rt2.AppendStyle( rtsHeader2 )

	

	Call rt2.AddNewLine( 3 )

	Call rt2.AppendText( "Last Name" )

	Call rt2.AddTab( 2 )

	Call rt2.AppendText( "Employee #" )

	Call rt2.AddTab( 1 )

	Call rt2.AppendText( "Current Asset" )

	Call rt2.AddTab( 1 )

	Call rt2.AppendText( "Current Serial" )

	Call rt2.AppendStyle( rtsNormal )     'The style that would be applied on text bellow header

	

	Set cur = c.GetFirstDocument

	Do Until cur Is Nothing

		Call rt2.AddNewLine( 1 )

		Call rt2.AppendText( cur.lname(0) )

		Call rt2.AddTab( 2 )

		Call rt2.AppendText( cur.emp_num(0) )

		Call rt2.AddTab( 2 )

		Call rt2.AppendText( cur.current_asset(0) )

		Call rt2.AddTab( 3 )

		Call rt2.AppendText( cur.current_svg_tag(0) )

		Call rt2.AddTab( 3 )

		Call rt2.AppendDocLink( cur, "Link to document " )  'add link to doc to the end

		

		Set cur = c.GetNextDocument( cur )

	Loop

	newDoc2.Form = "Memo"

	newDoc2.Subject = "IBPC Refresh Reclamation Ready"' + cur.office_num_adjusted

	Call newDoc2.Save( True, True )

	newDoc2.CopyTo = "Field Technology"

	Call newDoc.Send( True, "Field Technology" )

	'Call newDoc2.Send( True, "MAC_INBOX" )

	

	Call doc.FieldSetText("status", "Reclamation Approved")

	Call doc.FieldSetText("reclamation_approved_flag", "done")

	

End Sub

Open in new window

0
Comment
Question by:jforget1
3 Comments
 
LVL 22

Accepted Solution

by:
mbonaci earned 500 total points
ID: 22760622
Replace FieldSetText with ReplaceItemValue.

See previous question.


Marko
0
 
LVL 5

Expert Comment

by:daj_uk
ID: 22760681
Do you wish to update the values and show the changes on screen?  Or simply update the values in the background?
0
 

Author Comment

by:jforget1
ID: 22760932
Thanks again Mb

Jforget,

FieldSetText is used when the user has document opened in edit mode and is the method of NotesUIDocument, not NotesDocument.

You can replace FieldSetText with ReplaceItemValue, like this:

      Call doc.ReplaceItemValue(FieldName, NewValue)

or in your case:

      Call doc.ReplaceItemValue("status", "Reclamation Approved")
      Call doc.ReplaceItemValue("reclamation_approved_flag", "done")


Thanks for the points,
Mb¤
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now