如何构造变量列名? [英] How can I construct a variable column name?

查看:59
本文介绍了如何构造变量列名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Access2007 VBA

我目前有以下代码:

Access2007 VBA
I currently have the following code:

展开 | 选择 | Wrap | 行号

推荐答案

要回答你的问题,是的,它应该是可能的。


很大程度上取决于你如何分配这些值。还不清楚鳕鱼是如何鳕鱼的。扮演这个?这是另一张桌子吗?该表与您的第一张表有什么关系?你怎么知道表Cod中使用哪条记录? OR - 您是否尝试将Table Cod中的特定字段指定为控件名称U17的记录源?


因此,在我们可以指导任何更明确的解决方案之前,我们需要更多信息。
To "answer" your question, yes it should be possible.

Much of it depends on how you are trying to assign these values. It is also unclear how "Cod" plays into this? Is this another table? How is that Table related to your first table? How do you know which record in table Cod to use? OR--are you trying to assign a particular field in Table Cod as a record source for a control names U17?

So, before we can guide to any more definite solutions, we need a little more information.


我有一个事务表,需要更新每一行从包含最多30个可能值的另一个表(COD)中的10个值(列Cod1到Cod30)。这两个表具有一对一的关系。问题是从30个可用的10列的选择因客户而异。我有另一个表(Cust),每个客户端有一行,有10列(UTC17到UTC26),每个表对应于需要更新的事务表中的每一列。 Cust表中的10列中的每一列都有一个与COD表中的源列对应的数字。

流程为:

1.读取事务
2.获取具有相同ID的COD行

3获取交易的Cust行

4.对于每个Cust!UTCnn获取Cod! Codnn

例如如果Cust!UTC17在Cod中包含5个值!选择Cod5。

5.使用步骤4中的值更新事务中的UTCnn


我希望这使得这个过程更加清晰。我承认表格设计有点不尽如人意,但除了Cust表之外,它们都不受我的控制。
I have a transaction table and need to update each row with up to 10 values from another table (COD) containing up to 30 possible values (columns Cod1 to Cod30) . The 2 tables have a one to one relationship. The problem is that the selection of the 10 columns from the 30 availble varies from client to client. I have another table (Cust) which has one row per client with 10 columns,(UTC17 to UTC26) one for each of the columns in the transaction table that needs to be updated. Each of the 10 columns in the Cust table has a number corresponding to the source column in the COD table.
The flow is:
1. Read a transaction
2. Get the COD row with the same ID
3 Get the Cust row for the transaction
4. For each Cust!UTCnn get the Cod!Codnn
e.g. if Cust!UTC17 contains 5 the value in Cod!Cod5 is selected.
5. Update UTCnn in the transaction with the value from step 4

I hope this has made the process a bit clearer. I acknowledge that the table design leaves a bit to be desired but, except for the Cust table, they are out of my control.


我认为Twinnyfo正在考虑一种灵活的方式来做它一行中的东西,但快速而肮脏的方法是:
I think Twinnyfo is thinking of a slick way to do it things in one line, but a quick and dirty way to do this is:
展开 | 选择 | Wrap | 行号


这篇关于如何构造变量列名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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