[AccessD] Iteration construct to print variables

Geldart, Robert RGeldart at detma.org
Tue Mar 11 12:41:00 CST 2003


List,

I'm doing an output to file routine in a module. 

I have a number of variables dimmed as long -- c1, c2, c3, c4, ... c20 

The data file is required to put each data field on a separate line:
	tDate
	c1
	c2
	...
	c20

My data is a single recordset of a query. I make a number of calculations
and then output all the  results:

	c1 = rst!FieldOne
	c2 = rst!FieldTwo
	c3 = rst!FieldThree
	c4 = c1 + c2 + c3
	...
	Print #1, c1
	Print #1, c2
	Print #1, c3
	Print #1, c4
	...

It seems to be inefficient to have 20 lines of "Print #1, c..." Is there a
way I could run a loop something like?

	For i = 1 to 20
		Print #1, "c" + i
	Next i

I know that specifically won't work as I tried it, but I hope you can see
what I'm driving at. I would like to loop through variables (c1...c20) and
do a Print# for each.

Thanks for your help,

Bob Geldart
RGeldart at detma.org
Massachusetts Department of Employment & Training



More information about the AccessD mailing list