嵌套的IIF太多了 [英] Too many nested IIF's

查看:132
本文介绍了嵌套的IIF太多了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everyone,


虽然我可以在SQL中运行它,但我并不完全习惯于Access的做事方式。我有一个查询,有太多的嵌套IIF,并试图找出是否有办法在VBA中编写以下代码?或者,如果还有另一种更有效的方法?任何帮助将不胜感激!

Hello Everyone,

While I could run this in SQL, I''m not entirely used to the Access way of doing things. I have a query that has far too many nested IIFs and have been trying to figure out if there is a way to code the following in VBA? Or if there is another more efficient way? Any help would be greatly appreciated!

展开 | 选择 | Wrap | 行号

推荐答案

Gareth,你在尝试什么实现(并且请不要指望我对您的代码进行反向工程以确定您的问题应包括哪些内容)?


有各种功能(Switch(); Index( );;)在某些情况下可以提供帮助,但细节决定了何时何地。
Gareth, what are you trying to achieve (and please don''t expect me to reverse-engineer your code to work out what your question should include)?

There are various functions (Switch(); Index(); etc) that can help in some case but the details determine where and when.


您好,谢谢您的回复。


我有一个中央客户表dbo.Customer与fol低场:

地址1

地址2

地址3

地址4

地址5

地址6

邮政编码


和国家表格有:

Country_code

Country_name


我要做的是检查customer_code和Country_name的客户表(每行)上的每个变量,如果存在,则分配一个带有Country_name的变量国家/地区。


因此,如果我在这些字段中匹配国家/地区名称或国家/地区代码,则会分配该国家/地区名称。

谢谢


Gareth
Hi thanks for your response.

I have a central customer table dbo.Customer with the following fields:
Address1
Address2
Address3
Address4
Address5
Address6
Postcode

And a country table that has:
Country_code
Country_name

What I''m trying to do is check each variable on the customer table (for each row) for the Country_code and the Country_name and then if it exists, assign a variable Country with the Country_name.

So if I match on any of those fields for a country name OR a country code then I get assigned that country name.

Thanks

Gareth


对不起只是为了完全清楚,我想最终得到一张表:


Customer_Code

国家


通过检查上面列出的每个字段以及是否有匹配来填充使用Country。进入新表。
Sorry just to be completely clear, I want to end up with a table that has:

Customer_Code
Country

That is populated by checking each field listed above and if there is a match then a new entry goes into the new table with Country.


这篇关于嵌套的IIF太多了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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