我需要IF语句的帮助 [英] I need help with an IF statement

查看:65
本文介绍了我需要IF语句的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在查询中有一个名为结果代码的列。这些结果代码是45,80,30等。我想要做的是因为我有运行的查询我构建了一个报告,它显示结果代码很好,但我想让它将结果代码转换为文本我指定的。


结果代码= 30的例子我希望它说不感兴趣而不是显示30


有人可以指导我朝正确的方向发展吗?


谢谢

I currently have a column in a query that is called result codes. These result codes are either 45,80,30 etc.. What I am trying to do is since I have the query that runs I built a report and it show the result code fine but I want to have it covert the result code to text that I specify.

Example if result code = 30 I want it to say "Not Interested" instead of showing 30

Can someone guide me in the right direction?

Thank you

推荐答案

你好伙伴。

这取决于你想要多少代码翻译文本,以及要显示多少个不同的文本。


就个人而言,我会创建带有代码的表格,并在此表中进行查询。


CodeId |描述

------------------------

30 |未插入

80 |未插入

45 |未插入


问候

cureben
Hi mate.
It is depend on how many codes would you like "translate" to text, and how many different text you want to show.

Personally, I would have created the table with codes and and this table to query.

CodeId | Description
------------------------
30 | Not inserted
80 | Not inserted
45 | Not inserted

Regards
cureben


如果您在访问查询中对此进行评估,请使用Switch ()看起来像这样


切换([你的字段] = 30,不感兴趣,[你的字段] = 80,你的文字,[你的字段] = 45 ,其他文本,......)


如果您使用的是VBA,请使用看起来像这样的Select Case
If you''re evaluating this in an access query, use a Switch() that will look like this

Switch([yourfield]=30,"Not Interested",[yourfield]=80,"Your text",[yourfield]=45,"Other Text",......)

If you''re using VBA, use a Select Case that looks like this
展开 | 选择 | Wrap | 行号


@ dsatino

谢谢大家的帮助这就是我所拥有的


SELECT CallHist.ResultCode,Count(CallHist.ResultCode)AS CountOfResultCode,CallHist.UserID,CallHist.QueueNo,Count(CallHist.QueueNo)AS CountOfQueueNo

来自CallHist

WHERE(((CallHist.CallDT)> = [输入开始日期]和(CallHist.CallDT)< = [输入结束日期]))

GROUP BY CallHist.ResultCode ,CallHist.UserID,CallHist.QueueNo

ORDER BY CallHist.ResultCode;


我在哪里放置开关以及如何使用?
@ dsatino
Thank you everyone for the help this is what I have

SELECT CallHist.ResultCode, Count(CallHist.ResultCode) AS CountOfResultCode, CallHist.UserID, CallHist.QueueNo, Count(CallHist.QueueNo) AS CountOfQueueNo
FROM CallHist
WHERE (((CallHist.CallDT)>=[Enter Start date] And (CallHist.CallDT)<=[Enter End Date]))
GROUP BY CallHist.ResultCode, CallHist.UserID, CallHist.QueueNo
ORDER BY CallHist.ResultCode;

Where would I put the switch and how?

这篇关于我需要IF语句的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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