[AccessD] Max of 20 values

jwcolby jwcolby at colbyconsulting.com
Sat Jul 23 10:36:01 CDT 2011


 > This topic raises an ancillory question: supposing a number of fields named M1...M20, how can one 
code a loop that grabs their names and walks the loop and obtains these controls' values?

Each form has a controls collection

dim ctl as control
for each ctl in me.controls
	'now look at the control name
next ctl

Having a nice neat naming convention helps.

M01, M02 etc allows you to simply do

	if left(ctl.name,1) = "m" then
		debug.print ctl.value
	endif

John W. Colby
www.ColbyConsulting.com

On 7/23/2011 11:28 AM, Arthur Fuller wrote:
> Ok, I won't pay you a penny but go ahead and code it. There are four
> subforms, call them LC#_fsub, each tied to a parent whose values derive from
> the subform. I have this working for subform1 and can clone the sub proc for
> each of them, but this strikes me as seriously inelegant.
>
> This topic raises an ancillory question: supposing a number of fields named
> M1...M20, how can one code a loop that grabs their names and walks the loop
> and obtains these controls' values? Perhaps Eval? I am seriously unsure upon
> this turf.
>
> A.



More information about the AccessD mailing list