Need help in field declaration

Hey pple,i’m having some prob in field declaration in Do…while statement.

eg. in collection.count from a particular view, there are 3 documents. i’m trying to port these 3 documents’ data into form A using Do…while statement.

form A contains a simple table with the following fields:

submitted1, claimant1, manager1

submitted2, claimant2, manager2

submitted3, claimant3, manager3

thus during the iteration, i’m trying to use a tmp counter to determine fields in form A shd be assigned.

Set doc11=collection.GetFirstDocument

tmpcount = 1

Set db1 = s.currentdatabase

Set doc1 = db1.CreateDocument

Do While Not (doc11 Is Nothing)

doc11.editmode = True

doc11.sendforapproval= “Yes”

doc1.form = “Petty Cash Approval”

doc1.requestedby = s.CommonUserName

doc1.requesteddate = Format$(Now, “dd-mmm-yyyy hh:nn AM/PM”)

doc1.submittedby&tmpcount = doc11.Submitted(0)

doc1.claimant&tmpcount = doc11.Claimant(0)

doc1.manager&tmpcount = doc11.Manager(0)

Call doc1.Save(True,False)

Call doc11.Save(True,False)

Set doc11 = collection.GetNextDocument(doc11)

tmpcount = tmpcount + 1

Loop

but of course it doesnt work…hope someone is able to help me.

thanks

Subject: Need help in field declaration

well, I haven’t tried this, and you don’t say what “doesn’t work”, but one obvious problem will be here …

doc1.submittedby&tmpcount = doc11.Submitted(0)

firstly, tmpcount is a number, so you can’t make a field called “submittedby&tmpcount” - you should get a syntax error trying to “&” a string and a number.

but anyway, next, the whole syntax of “doc1.submittedby&tmpcount =” is wrong - if you want to make a field called “submittedby1” and another called “submittedby2” then you must make a variable that has the value “submittedby1” and then do a different NotesDocument call to create a field by that name.

HTH

Subject: RE: Need help in field declaration

hi hi…:)i’ve tried earlier on as seen below :

tmpsubmittedby = “submittedby” & tmpcount

it did return me “submittedby1” when i use msgbox to display.

however, when i use doc1.tmpsubmittedby = doc11.Submitted(0), though no error msg, no value was assigned to submittedby1.

:frowning:

Subject: RE: Need help in field declaration

with the variable you made, look at using ReplaceItemValue

dim Item as NotesItem

Item = doc1.ReplaceItemValue( tmpsubmittedby, doc11.whatever-you-want )

Subject: RE: Need help in field declaration

you are my saviour!!!it works.

thanks a million…:slight_smile: