How to handle arrays in Access tables

若如初见. 提交于 2020-04-16 02:57:06

问题


I have a table in MS-Access that needs to contain an array of 4 (type number) values. At the moment they are in named fields, VAL1, VAL2, VAL3, VAL4. However, that’s cumbersome (the number of values may be larger) because I want to use a loop in the associated VBA code, which generates a binary data file from the database tables.

Is it possible for VBA to access table fields using raw index values? As an example, if I have a table with the following fields:

Name VAL1 VAL2 VAL3 VAL4

Can I reference fields using generic names and indices, so that my 4 VAL fields can be accessed in a loop using a structure such as TableName.field(i)?


回答1:


I think it will be a lot better for you now, and especially in the long run, if you name your fields relevant to what they actually represent. That's my .02.



来源:https://stackoverflow.com/questions/43348622/how-to-handle-arrays-in-access-tables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!