downhilljon
Registered User.
- Local time
- Tomorrow, 02:56
- Joined
- Jun 14, 2007
- Messages
- 31
Hi,
Have had a big break from coding, so feeling a little stupid. Hope someone can help!
The following method seems to me to be the best solution (with my limited knowledge), but am willing to accept suggestions on better methods.
In the big picture, I have a table (tblBrands) with the primary key as an autonumber, specifiying the BrandID. During the course of building and testing the database, the autonumber has skyrocketed, so while I only have 12 records in tblBrands, the autonumber currently goes upto a value of 110.
I'd like to obtain each of the 12 BrandID values for use later on, and thought an array would be handy to store them in. However I can't for the life of me figure out how to get the values from the table!
Here is my code so far:
As an alternate method I believe I could open a recordset to obtain the values, but don't really understand recordsets, and as I am just making some small changes to my database, don't really want to invest time into learning a whole new area.
Hope someone has a suggestion!
Cheers,
Jon
Have had a big break from coding, so feeling a little stupid. Hope someone can help!
The following method seems to me to be the best solution (with my limited knowledge), but am willing to accept suggestions on better methods.
In the big picture, I have a table (tblBrands) with the primary key as an autonumber, specifiying the BrandID. During the course of building and testing the database, the autonumber has skyrocketed, so while I only have 12 records in tblBrands, the autonumber currently goes upto a value of 110.
I'd like to obtain each of the 12 BrandID values for use later on, and thought an array would be handy to store them in. However I can't for the life of me figure out how to get the values from the table!
Here is my code so far:
Code:
intBrands = DCount("BrandID", "tblBrands")
'Create loop to go through tblBrands correct number of times, storing BrandID's in an array.
ReDim varArray(1 To intBrands)
For intCounter = 1 To intBrands
'varArray(intCounter) = and here I need to get the value from tblBrands
Next intCounter
As an alternate method I believe I could open a recordset to obtain the values, but don't really understand recordsets, and as I am just making some small changes to my database, don't really want to invest time into learning a whole new area.
Hope someone has a suggestion!
Cheers,
Jon