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 1 year has passed since last update.

AccessのVBAでユーザー名やPC名をとにかく簡単に取得

Last updated at Posted at 2023-01-30

概要

『実行ユーザー名』や『実行PC名』はテーブルのカラムやログなどに記録することが多い。
(例外発生時のトレースとかいろいろで使う)

とにかく簡単に(コーディング量少なく)取得したい。

やり方

Environ() という『環境変数の値を取得する関数』がある。

実行ユーザー名取得
Environ("USERNAME")
実行PC名取得
Environ("COMPUTERNAME")

蛇足

「環境変数ってなんぞ?」って時は下記。

バージョン

Windows 10 Pro 22H2 OSビルド 19045.2546
Microsoft Access for Microsoft 365 MSO (バージョン 2212 ビルド 16.0.15928.20196) 32 ビット

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?