Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB - Editing Notes Databases

Posted on 1999-08-03
16
Medium Priority
?
196 Views
Last Modified: 2013-12-18
I am currently trying to edit a Lotus Notes database using Notes classes. The problems are as following:
1) When trying to view the object variables I create (such as NotesItem, NotesDocument), VB comes up with the error "Object Library not Registered". Which file do I need to register to remove this error?

2) When using the ReplaceItemValue command, the value of the item is cleared, but not replaced. Also, when I view the relevant document in Lotus Notes, the form displays a cleared value, but the view displays the value before it was cleared. where does this inconsitency come from? I am using the code below:

doc_src is a NotesDocument, Text2 is a textbox containing the name of a valid item and Text3 is a textbox containing a string. This item I am trying to change is of type Text.

doc_src.REPLACEITEMVALUE Text2, Text3

I am using VB5 and Notes 4.6.2a

Thank you for any help
0
Comment
Question by:bensewell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 7
16 Comments
 
LVL 6

Expert Comment

by:ghassan99
ID: 1120104
u need to add a reference to the file notes32.tlb
The syntax for replaceitem:

notesItem = notesDocument.ReplaceItemValue( itemName$, value )

so what u need to do:
doc_src.REPLACEITEMVALUE "ur field name in notes", Text3



0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1120105
try trimming the value

0
 

Author Comment

by:bensewell
ID: 1120106
Thanks for replying, ghassan99. However, I already have a reference to notes32.tlb!

This is also already the format in which I have my statement.

I have tried another approach now, though. I used the following code:

dim newitem as object
set newitem = doc_src.GETFIRSTITEM(Text2.Text)
newitem.Values(0) = Text3.Text
doc_src.REPLACEITEMVALUE Text2, newitem.Values
doc_src.SAVE True, False

(I did have the last line previously, I just forgot to mention it).

Do you have any idea about the inconsistency between form and views? The document properties informaiton box contains the updated values, and closing and reopening the view also does nothing to help.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:bensewell
ID: 1120107
By the way, the new code does update the form correctly now!
0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1120108
Ok I'm sorry I didnt get u at first...
actrually all u need to do is this:
doc_src.REPLACEITEMVALUE Text2.text, Text3.text

0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1120109
try using shift+f9 when u r in the view in notes
0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1120110
u can see the class in the object broswer but when u click on it, it gives an error message?
0
 

Author Comment

by:bensewell
ID: 1120111
Sorry for the confusion; I can use the Object browser with no ahssle, but the Watch window is providing error messages.

shift-f9 works, thanks.
The new code works.
0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1120112
Try re-installing notes then
0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1120113
If u put the following in the watch window:
doc.any_field_name_in_doc

Does it produce an error?
0
 

Author Comment

by:bensewell
ID: 1120114
This is not an extension to the question, but it may be a related problem (to help anyone bugfind). To view a field from VB, have been using the code:

dim item as Variant
item = doc_src.GETITEMVALUE(Text1)
msgbox item(0)

which works fine. however, as an experiment, I though I would try a different approach (as I know little about these classes):

dim newitem as object
set newitem = doc_src.GETFIRSTITEM(Text1.Text)
msgbox newitem.Values(0)

The final line generates the error "Variable uses an Automaion type not supported in Visual Basic"(458). This is not a problem, as I can work around it, but an interesting point, perhaps.
0
 

Author Comment

by:bensewell
ID: 1120115
ghassan99,

No, there is no error when I put this into the Watch window. It displays correctly
0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1120116
then when does the problem occur?
0
 

Author Comment

by:bensewell
ID: 1120117
this problem occurs when I try to view doc_src in the Watch window, or an item variable
0
 

Author Comment

by:bensewell
ID: 1120118
ghassan99,

Since I do not need the final functionality - I have completed the project anyway - Submit a, "answer" and I will award the points. Thanks for your help
0
 
LVL 6

Accepted Solution

by:
ghassan99 earned 280 total points
ID: 1120119
Thank you:)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

704 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