如何缩短使用if,else和end if的代码? [英] How to shorten codes that using if, else and end if?

查看:103
本文介绍了如何缩短使用if,else和end if的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想缩短我的代码因为我遇到了编译错误:程序太大了。有没有办法用最短的代码完成这些事情?


这是我的示例代码:我有一百个这样的代码,我只贴了12个给你看。

I want to shorten my codes coz i got a compile error: procedure too large. is there a way that these thing can be done in shortest code?

this are my sample codes: i have a hundred of this codes, i only pasted 12 to show you.

展开 | 选择 | Wrap | 行号

推荐答案

关于你所展示的代码,还有很多话要说。


首先,从我看到的,似乎你所显示的代码中的if / then / else语句是超级的,你可以简单地把它写成:

Well there is alot to say about the code you have shown.

First of, from what I see, it seems your if/then/else statements in the shown code are superflous, you could simply write it as:

展开 | 选择 | Wrap | 行号


来自Smiley的第一段代码可以替换你的所有代码。

但是我可以问你为什么首先在设计视图中打开你的报告?

为了查看你的报告,这行不是必需的:
Of corse the first piece of code from Smiley can replace all your code.
But may I ask you why you first open your report in design view ?
This line is not necessary in order to view your report:
展开 | 选择 | Wrap | 行号


我认为我们在这里缺少的要点是为了动态更改报告的记录来源,我们应该:
I think that the Main point that we are missing here is that, in order to dynamically change the Record Source of a Report, we should:
  1. 在设计模式下打开报告并隐藏
  2. 修改记录的来源
  3. 关闭报告,保存更改
  4. 使用修改后的记录源打开报告
  1. Open the Report in Design Mode and Hidden
  2. Modify the Record Source of the Report
  3. Close the Report, Saving the changes
  4. Open the Report with the modified Record Source
展开 | 选择 | Wrap | 行号


这篇关于如何缩短使用if,else和end if的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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