将字段值字符串转换为表达式中的实际字段 [英] Convert Field Value String to Actual Field in Expression

查看:58
本文介绍了将字段值字符串转换为表达式中的实际字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试提高查询的性能,我想知道这是否可以在Access中使用。


让我们说我有一个表[fieldtable]一个文本列[field1]和一行。


在该列中,我有另一个表[TransactionTable]的字段名称。这个字段表从表单中更新,但它从来没有多行。


因此,我的[fieldtable]中的示例 value 看起来像这样:


[TransactionTable]。[名称]


如果我把两个表放在我的查询中,没有链接,我希望能够根据我的[fieldtable]中显示的字符串调用我的[TransactionTable]中的字段。



所以我在这个示例查询中的表达式将是


TransField:[fieldtable]。[field1]


这将有效地给我这个:


TransField:[TransactionTable]。[名称]


这不起作用,但我正在寻找一些方法让它工作,如果可能的话。有什么想法吗?

解决方案

不要把fieldtable放在你的查询中。你可以参考:


Dlookup(" [Field1]",[FieldTable]")


< blockquote class =post_quotes>
我正在尝试提高查询的性能,我想知道这是否可以在Access中使用。


让's'假设我有一个表[fieldtable],其中包含一个文本列[field1]和一行。


在该列中,我有另一个表[TransactionTable]的字段名称。这个字段表从表单中更新,但它从来没有多行。


因此,我的[fieldtable]中的示例 value 看起来像这样:


[TransactionTable]。[名称]


如果我把两个表放在我的查询中,没有链接,我希望能够根据我的[fieldtable]中显示的字符串调用我的[TransactionTable]中的字段。



所以我在这个示例查询中的表达式将是


TransField:[fieldtable]。[field1]


这将有效地给我这个:


TransField:[TransactionTable]。[名称]


这不起作用,但我正在寻找一些方法让它工作,如果可能的话。有任何想法吗?



不要将字段表放在查询中。你可以参考:


Dlookup(" [Field1]",[FieldTable]")



谢谢,有趣的是,我不知道DLookup。我试了一下,但我仍然得到了价值。现场而不是实际领域。


当我尝试这个时,我的所有行仍然说


[TransactionTable]。[名称]

[TransactionTable]。[姓名]

[TransactionTable]。[姓名]

[TransactionTable]。[姓名]

[TransactionTable]。[姓名]


当我想让他们说:


Bob Parker

Mary Williams

John Smith

Randy Jones

Lana Maxwell


换句话说, "姓名"交易表中的字段。


Zontar,


您在哪里引用值[TransactionTable]。[Name]


在查询或表格中?



谢谢,有意思,我没有'不了解DLookup。我试了一下,但我仍然得到了价值。现场而不是实际领域。


当我尝试这个时,我的所有行仍然说


[TransactionTable]。[名称]

[TransactionTable]。[姓名]

[TransactionTable]。[姓名]

[TransactionTable]。[姓名]

[TransactionTable]。[姓名]


当我想让他们说:


Bob Parker

Mary Williams

John Smith

Randy Jones

Lana Maxwell


换句话说, "姓名"事务表中的字段。


I''m trying to improve performance on a query, and I was wondering if this is possible in Access.

Let''s say I have a table [fieldtable] with one text column [field1] and one row.

In that column, I have a field name from another table [TransactionTable]. This fieldtable gets updated from a form, but it never has more than one row in it.

So an example value in my [fieldtable] look like this:

[TransactionTable].[Name]

If I put both tables in my query, without a link, I want to be able to call the field in my [TransactionTable] based on the string shown in my [fieldtable].



So my expression in this example query would be

TransField: [fieldtable].[field1]

which would effectively give me this:

TransField: [TransactionTable].[Name]


This does not work, but I''m looking for some way to make it work, if possible. Any ideas?

解决方案

Don''t put the fieldtable in your query. You can refer to it by:

Dlookup("[Field1]","[FieldTable]")


I''m trying to improve performance on a query, and I was wondering if this is possible in Access.

Let''s say I have a table [fieldtable] with one text column [field1] and one row.

In that column, I have a field name from another table [TransactionTable]. This fieldtable gets updated from a form, but it never has more than one row in it.

So an example value in my [fieldtable] look like this:

[TransactionTable].[Name]

If I put both tables in my query, without a link, I want to be able to call the field in my [TransactionTable] based on the string shown in my [fieldtable].



So my expression in this example query would be

TransField: [fieldtable].[field1]

which would effectively give me this:

TransField: [TransactionTable].[Name]


This does not work, but I''m looking for some way to make it work, if possible. Any ideas?


Don''t put the fieldtable in your query. You can refer to it by:

Dlookup("[Field1]","[FieldTable]")

Thanks, that Interesting, I didn''t know about DLookup. I tried it, but I am still getting the "Value" of the field and not the actual field.

When I tried this, all my rows still said

[TransactionTable].[Name]
[TransactionTable].[Name]
[TransactionTable].[Name]
[TransactionTable].[Name]
[TransactionTable].[Name]

When I wanted them to say:

Bob Parker
Mary Williams
John Smith
Randy Jones
Lana Maxwell

In other words, the "Name" field from the Transaction Table.


Zontar,

Where are you referencing the value [TransactionTable].[Name]

In a query or on the form?



Thanks, that Interesting, I didn''t know about DLookup. I tried it, but I am still getting the "Value" of the field and not the actual field.

When I tried this, all my rows still said

[TransactionTable].[Name]
[TransactionTable].[Name]
[TransactionTable].[Name]
[TransactionTable].[Name]
[TransactionTable].[Name]

When I wanted them to say:

Bob Parker
Mary Williams
John Smith
Randy Jones
Lana Maxwell

In other words, the "Name" field from the Transaction Table.


这篇关于将字段值字符串转换为表达式中的实际字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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