Refer to Field Name with Index

B

bw

My table has several groups of data with similar field names, i.e.; W1,
W2, W3, and U1, U2, U3, etc.
I would like to refer to these names as an array with an index.
Something like myValue=W(1) or myValue=U(2), etc.
Is there a way to do this?
--
 
B

Bob Hairgrove

My table has several groups of data with similar field names, i.e.; W1,
W2, W3, and U1, U2, U3, etc.
I would like to refer to these names as an array with an index.
Something like myValue=W(1) or myValue=U(2), etc.
Is there a way to do this?

Yes. Check out the help topic for the Fields collection of the
Recordset object.

In the long run, you will most likely be better off by normalizing
your design and splitting these numbered fields off into separate
related tables. Repeating groups like this violate first normal form
(1NF).
 
B

bw

My table has several groups of data with similar field names, i.e.; W1,
W2, W3, and U1, U2, U3, etc.
I would like to refer to these names as an array with an index.
Something like myValue=W(1) or myValue=U(2), etc.
Is there a way to do this?

Yes. Check out the help topic for the Fields collection of the
Recordset object.

In the long run, you will most likely be better off by normalizing
your design and splitting these numbered fields off into separate
related tables. Repeating groups like this violate first normal form
(1NF).

--
Bob Hairgrove
[email protected]

Thanks Bob!

Both suggestions seem to solve my problem. I have never heard of 1NF
until now, but I see the point. I can split these fields into separate
related tables, which is what I'll do.

Bernie
 
Top