HiI am trying to achieve the following:
Got a database, working with two forms, one called mandate and one called event, both forms have a company name which is the same. What I want to achieve is the following:
When I create an event and select the company, it looks at a view and pulls through all the mandates created for that specific company. I put the following script into the postopen of the event form but keep getting this error, I am a bit stuck. Any advice would be appreciate, a bit slow with script still.
Many thanks in advance… Coll
Here is the code:
Dim s As New NotesSession
Dim db As NotesDatabase
'Dim v As NotesView
'Dim vdoc As NotesDocument
'Dim cdoc As NotesDocument
'Dim count As Integer
'Set cdoc = source.Document
'Set db = s.CurrentDatabase
'Set v = db.GetView"(MandByOrgAndDate)")
'count = 0
'Set vdoc = v.GetFirstDocument
'While Not(vdoc Is Nothing)
If vdoc.iencompany(0) = cdoc.ienCompany(0)
Then count = count + 1
' strname = "LookupMandates"
' strname = strname + Cstr(count)
' Set fld = cdoc.GetFirstItem(strname)
' Forall x In fld.values this is were i am getting error on debug
' x = vdoc.IENProjectDescription(0)
' fld.values = x
' End Forall
' If count = 10 Then Exit Sub
' End If
' Set vdoc = v.GetNextDocument(vdoc)
'Wend
Subject: Need help with LotusScript…
Did you try debugging?What error do you get?
If you need any help you also can contact me on MSN.
Subject: RE: Need help with LotusScript…
HiNot set up on MSN…thanks for the offer.
When I debug, i get object variable not set and it stops at this line:
Forall x In fld.values
Really appreciate the help
Subject: Need help with LotusScript…
Set fld = cdoc.GetFirstItem(strname) Forall x In fld.values t
x = vdoc.IENProjectDescription(0)
fld.values = x
End Forall
I dont really understand what you are doing here.
What doi you wanne achive?
Subject: RE: Need help with LotusScript…
Basically, when I create an event, once i select the company…with the above I am trying to retrieve all the documents (one value) in a view relating to the specific view and storing in a field on my event form. Hope that makes sense.
Subject: Need help with LotusScript…
Ok if i understand well, retrieve one value from all documents in a view and place them in a field in a new document.
Still to hard to understand this way what to correct. But you cant do a forall on a field.
You have to do something like:
for i = 0 to uBound(cDoc.fieldName)
fieldValue = cDoc.fieldName(i)
next
Hope this helps, otherwise sent me the application and i will have a look.
Subject: RE: Need help with LotusScript…
I really appreciate your help, just a question, how would I incorporate that bit of code into my script?Thanks.
Subject: RE: Need help with LotusScript…
Sent the database to me and i will help you.
Subject: RE: Need help with LotusScript…
it is quite big, so will try, please could you give me your email address. many thanks.
Subject: RE: Need help with LotusScript…
its in my profile
Subject: RE: Need help with LotusScript…
sorry, blonde moment! havng a bad day, will send you db asap.