如何处理Access表中的数组 [英] How to handle arrays in Access tables

查看:99
本文介绍了如何处理Access表中的数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MS-Access中有一个表,该表需要包含4个(类型编号)值的数组.目前,它们位于命名字段VAL1,VAL2,VAL3,VAL4中.但是,这很麻烦(值的数量可能更大),因为我想在关联的VBA代码中使用循环,该循环从数据库表中生成二进制数据文件.

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.

VBA是否可以使用原始索引值访问表字段?例如,如果我有一个包含以下字段的表:

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:

名称VAL1VAL2VAL3VAL4

Name VAL1 VAL2 VAL3 VAL4

我可以使用通用名称和索引来引用字段,以便可以使用诸如TableName.field(i)之类的结构在循环中访问我的4个VAL字段吗?

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)?

推荐答案

我认为,如果您将字段命名为与它们实际代表的内容相关,那对您现在会好得多,尤其是从长远来看.那是我的.02.

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.

这篇关于如何处理Access表中的数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆