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!

how does an array work???

Status
Not open for further replies.

stellJess

Programmer
Oct 3, 2002
27
0
0
US
for an array, should the field be created in table design? if so, should it then be declared in vba code as an array? can you tell me how and where the data is stored according to the subscripts of the array? will the data be stored as long as the db exists?

please let me know because i think i should use an array to capture input for a field that will have multiple values per record.

in advance, thank you.

stellJess
 
You can't use an array as a data type for a field on your table. You should probably make 2 fields.

-Gary
 
Ok. but i will have 4 X 10 fields which is why an array would be perfect.

but how does the array work? will it store the data and can the data be retrieved at a later date?

if the data is being captured in the same named and same type field, isn't that the criteria for using an array?

just a bit confused and want to write efficient code.

any help is appreciated. thx
 
An array is an allocated block of memory that exists while your program runs. It allows you to access variables stored in memory locations allocated to the array using subscript notation.

If you want to save the contents of an array you must save each individual value in the array to a separate field in a table or tables. There are no facilities in Access tables to store an entire array as the value of a field in a table.
 
If you think that you need an array to define a field, then that means the data is not normalized enough. Create a separate table to hold the additional data. Give an example of your data if you need help in the normalization.
 
A table is a two dmensional array, and SQL is an array manipulation language. Store your array information as a table.

 
Thanks to everyone for the input. you gave me the answer i needed. therefore, i will create a table to capture the data that will be retrieved later.

thankYou, thankYou, thankYou!!!
 
stellJess

Just a small caveat. As my esteemed colleagues may well point out when they return from holiday, a table is not an array but rather a set, and SQL manipulates sets. In fact they are special sets called relations. A relation doesn't have guaranteed order whereas an array keeps the row (and column) order you gave it when you created it.

To make a table like an array, make sure you have a key field that can be used to preserve the correct row order.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top