如何将单个值字段引用到多值字段? [英] How to reference a single value field to a multi-value field?

查看:89
本文介绍了如何将单个值字段引用到多值字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将单个值字段引用到多值字段?


我有时会使用form1中的宏来打开包含相同ID的表单2


例如:

开放表格:WorkOrder

where condition:=" [TenantID] =" &安培; Nz([TenantID],0)


你怎么写这个相同的参考但是对于多值字段?


=[TenantID] = &安培; Nz([多值表达式?],0)


EDIT____________


我试过:

=" [TenantID] =" &安培; Nz([TenantID],0)

=" [TenantID] =" &安培; Nz([TenantID] .Value,0)

=" [TenantID] =" &安培; Nz(([TenantID] .Value),0)

=" [TenantID] =" &安培; Nz([TenantID]。[Value],0)

=" [TenantID] =" &安培; Nz(([TenantID]。[Value]),0)


且没有工作

解决方案

嗨jaad,


当您说多值字段时,您是否在谈论列表框,您可以在其中选择多个值?


如果是,您可以将以下VBA用于表单上的某些事件(您需要将YourListBoxName更改为您在表单上的列表框中使用的实际名称):

展开 < span class =codeDivider> | 选择 | Wrap | Line数字


Hello Beacon并感谢您回复我的问题我真的很感激。


从我所掌握的Vb代码知识有限,我认为你编写的代码可以工作,但我在哪里放这段代码?点击事件?


我以前的工作方式很简单,因为我当时只负责为一个住宅中的一个住户执行一个工单,但现在我已经收到了费用许多(或批量工作订单),所以有时需要在许多地方与许多租户进行相同的工作,以及我有多选TenantID字段的原因,以便我可以将租户分批到一个工单。


欢呼

Jaad


这一切都非常有意义,类似于我最近在我正在处理的数据库。


您是否将宏指定给表单上的命令按钮?如果是这样,代码的可能位置将是同一命令按钮的OnClick事件...这就是我通常所做的事情。


万一你不喜欢要知道,如果你选择走这条路线,你需要在命令按钮的OnClick事件中声明变量:

展开 | 选择 | Wrap | 行号

how do you reference a single value field to a multi-value field?


I sometime use a macro in form1 to open form 2 containing the same ID

example:
Open form: WorkOrder
where condition: ="[TenantID]=" & Nz([TenantID],0)


How do you do write this same reference but for a multi value field?

="[TenantID]=" & Nz([Multi-value expression?],0)

EDIT____________

I tried:
="[TenantID]=" & Nz([TenantID],0)
="[TenantID]=" & Nz([TenantID].Value,0)
="[TenantID]=" & Nz(([TenantID].Value),0)
="[TenantID]=" & Nz([TenantID].[Value],0)
="[TenantID]=" & Nz(([TenantID].[Value]),0)

and none worked

解决方案

Hi jaad,

When you say multi-value field, are you talking about a List Box where you can select multiple values?

If so, you can use the following VBA for some event on your form (you''ll need to change YourListBoxName to the actual name you are using for your list box on your form):

Expand|Select|Wrap|Line Numbers


Hello Beacon and thanks for responding to my question, I really appreciate it.

From what I can tell with my limited amount of knowledge in Vb codes I think the code you wrote would work but where do I put this code? on Click event?

How I used to do it was simple because I was in charge of performing only one work order at the time for one tenants that lives in one building but now I have been given the charge of many (or batch work orders) so sometime the same work needs to be performed with many tenants at many location and reason why I have a multi select TenantID field so I can batch the tenants into one work order.

cheers
Jaad


That all makes perfect sense and is similar to the reasons why I implemented this recently in a database I was working on.

Were you assigning the macro to a command button on your form? If so, the likely place for the code would be the OnClick event for the same command button...that''s what I typically do.

Just in case you don''t know, you''ll need to declare the variables in the OnClick event for the command button if you choose to go that route:

Expand|Select|Wrap|Line Numbers


这篇关于如何将单个值字段引用到多值字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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