Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Looping through report component


Message #1 by Sam Hindawi <sam_hindawi@e...> on Wed, 2 May 2001 11:26:07 -0400 (EDT)
This would save me a lot of time .. hope you can help.



I am trying to loop through report component that has similar names e.g.

box1, box2, box3. I want my code to look something like this:



for i = 1 to 10

box & i = "test"

next



This way I end up with all components box1, box2, etc. having the value

"test"



How can I do this loop variable concatenation?



Thanks,

Sam







Sam Hindawi 

E-business Database Consultant 

Inter-Train 

Ontario, Canada 

Tel/Cell:  xxx.xxx.xxxx  

Fax:  xxx.xxx.xxxx  



-----------------------------------------------

FREE! The World's Best Email Address @email.com

Reserve your name now at http://www.email.com





Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Mon, 07 May 2001 14:52:18 -0700
You should be able to assign the control name to a string variable, and then

use that string variable as the index into the report's .Controls

collection.  For instance:



Dim i as Integer

Dim strBoxName as String



For i = 1 to 10

	strBoxName = "Box" & CStr(i)

	me.Controls(strBoxName).Value = "test"

Next i



Hope that helps...



-Roy



-----Original Message-----

From: Sam Hindawi [mailto:sam_hindawi@e...]

Sent: Wednesday, May 02, 2001 8:26 AM

To: Access

Subject: [access] Looping through report component





This would save me a lot of time .. hope you can help.



I am trying to loop through report component that has similar names e.g.

box1, box2, box3. I want my code to look something like this:



for i = 1 to 10

box & i = "test"

next



This way I end up with all components box1, box2, etc. having the value

"test"



How can I do this loop variable concatenation?



Thanks,

Sam







Sam Hindawi 

E-business Database Consultant 

Inter-Train 

Ontario, Canada 

Tel/Cell:  xxx.xxx.xxxx  

Fax:  xxx.xxx.xxxx  


  Return to Index