![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi. I would like to create an array and use the data to populate some new records when the user clicks on a button (that's the short description). If I were to code the array in C (I know ... not this forum, but it's what I know) I would do it like this ... /* Declare the structure template */ struct recdata { long classID; char lvl; }; I would then define the array of structs as follows: struct recdata classinfo[8] = {{ 0x01, "A" }, { 0x01, "B" }, { 0x01, "C" }, { 0x02, "A" }, { 0x02, "B" }, { 0x02, "C" }, { 0x03, "A" }, { 0x03, "B" }}; I'd probably define a recdata pointer and bump the pointer through the array. Is this possible in VBA? I have two books on Access and VBA and neither covers arrays too well. Regards, SueB *** Sent via Developersdex http://www.developersdex.com *** |
#3
| |||
| |||
|
|
Hi. I would like to create an array and use the data to populate some new records when the user clicks on a button (that's the short description). If I were to code the array in C (I know ... not this forum, but it's what I know) I would do it like this ... /* Declare the structure template */ struct recdata { long classID; char lvl; }; I would then define the array of structs as follows: struct recdata classinfo[8] = {{ 0x01, "A" }, { 0x01, "B" }, { 0x01, "C" }, { 0x02, "A" }, { 0x02, "B" }, { 0x02, "C" }, { 0x03, "A" }, { 0x03, "B" }}; I'd probably define a recdata pointer and bump the pointer through the array. Is this possible in VBA? I have two books on Access and VBA and neither covers arrays too well. Regards, SueB *** Sent via Developersdex http://www.developersdex.com *** |
#4
| |||
| |||
|
|
Hi. I would like to create an array and use the data to populate some new records when the user clicks on a button (that's the short description). |
#5
| |||
| |||
|
|
Susan Bricker <slbrick (AT) verizon (DOT) net> wrote in news:47900757$0$514$815e3792 @news.qwest.net: Hi. I would like to create an array and use the data to populate some new records when the user clicks on a button (that's the short description). What's the long description? Except for speed, I cannot think of any advantage an array would have over a recordset. And except for detailed calculations, SQL INSERTS are almost always better than populating a recordset. If you tell us what you are trying to do from a practical point of view we may be able to suggest a good strategy in VBA/Accees/JET, or whatever. Perhaps it will be to use arrays as you plan, but I doubt that. VBA arrays are the least powerful array construct I have ever seen, by a factor of ten or so. When I moved from Clipper to Access I had to learn to do things in different ways using different tools, not to do things in the same way using different tools. |
#6
| |||
| |||
|
#7
| |||
| |||
|
#8
| |||
| |||
|
#9
| |||
| |||
|
#10
| |||
| |||
|
|
So no one caught my error in the C Language explanation of what I am looking to do? Hmmmm struct recdata classinfo[8] = {{ 0x01, "A" }, { 0x01, "B" }, { 0x01, "C" }, { 0x02, "A" }, { 0x02, "B" }, { 0x02, "C" }, { 0x03, "A" }, { 0x03, "B" }}; is INCORRECT and it SHOULD BE ... struct recdata classinfo[8] = {{ 0x01, 'A' }, { 0x01, 'B' }, { 0x01, 'C' }, { 0x02, 'A' }, { 0x02, 'B' }, { 0x02, 'C' }, { 0x03, 'A' }, { 0x03, 'B' }}; notice the single quotes (') instead of the double quotes (") because the second field in the structure is defined as a single CHAR (1 byte) and not an array of CHARs (aka STRING). That'll teach me to type these posts way after midnight here on the EastCoast of USA. Thanks, again to all those who responded. Regards, SueB *** Sent via Developersdex http://www.developersdex.com *** |
![]() |
| Thread Tools | |
| Display Modes | |
| |