Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

For loop and concatenation!!

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
0
0
US
Hello again all! I am still working on the same project (but I have made lots of progress! Still trying to close uidoc w/o save prompt though!) So here's my next problem. I have 5 similar fields (prioraddress_1, priorcity_1, etc.) I am trying to write a for loop that will append the "number" to the end of the fieldname and set the value of a document. I have searched and found the documentation for concatenation, but IT DOESN'T WORK!!! I have tried using just one for loop, and two with different counter variables, and still can't figure this out. I get Illegal use of PROPERY when I try to run this. I have also tried the &, but the code turns red!

Here's my code, if any suggestions, would really appreciate it!

a = 1
For a = 1 To 5
docb.PriorAddress_+a = tempdoc.PriorAddress_+a
docb.PriorAddressApt_+a = tempdoc.PriorAddressApt_+a
docb.PriorAddressCity_+a = tempdoc.PriorAddressCity_+a
docb.PriorAddressState_+a = tempdoc.PriorAddressState_+a
docb.PriorAddressZip_+a = tempdoc.PriorAddressZip_+a
docb.AtPriorAddressYr+a = tempdoc.AtPriorAddressYr_+a
docb.AtPriorAddressMo+a = tempdoc.AtPriorAddressMo_+a
a = a + 1
Next

 
To exit the uidoc without saving try setting a field called "saveoptions" to "0".

As far as the code above, I would try:


a = 1
For a = 1 To 5
var1 = tempdoc.getitemvalue("PriorAddress_" + a)
docb.replaceitemvalue("PriorAddress_" + a, var1)
.
.
.
a = a + 1
Next


Good luck

Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top