0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AccessのVBEでコンパイルする方法と注意点

Last updated at Posted at 2020-11-05

バージョン

Access for Microsoft 365 MSO(16.0.13328.20262)32ビット
Windows10 Pro バージョン1909 OSビルド18363.1171

コンパイルする方法

Alt + F11 でVBE画面出して、これ。
image.png

何でコンパイルすんの?

  • 関数や変数なんかの名前変更時の修正漏れ
  • フォーム上に存在しないパーツを参照しちゃってる

とか炙り出せる。

例えばこんな感じ。
関数名変えたけど、戻り値のところ変え忘れた、みたいな。
image.png
VBEにリファクタリング機能付いてればいいのにね…(´・ω・`)

注意点

Option Explicit が無いとミスを炙り出せないことがあるぞい。
例えばこんなのはコンパイル通っちゃいます。
image.png
tester2を関数の戻り値ではなく、関数内の変数と解釈してるんだろうなあ…。

蛇足

インタープリンタだからコンパイルしても実行速度の向上は見込めないのかなあ…。
いちいち手でやるのダルイからファイル開くor閉じる時に自動でコンパイル走ってくれる設定とかあるといいなあ。今度探してみよう。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?