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のデータを更新する

Last updated at Posted at 2021-08-06

Accessでは、起動時にスイッチを指定して特殊な動作をさせることが可能です。
Microsoft Office 製品のコマンド ライン スイッチ

このうち/cmdスイッチを利用して、1つのデータベースファイルをオンライン?とバッチで共用する例です。


●起動用バッチファイル:Windowsのタスクスケジューラより起動

day01.bat
"C:\Program Files\Microsoft Office\OFFICExx\msaccess.exe" C:\Users\hoge\master.accdb /cmd "DAY01"

●データベースファイルの起動時プロシジャー:マクロ”AutoExec"より起動

    Select Case Command                     ' スイッチの内容を判定
    Case ""                                 ' 画面からの起動時
        DoCmd.Echo False, "お待ちください...."
        DoCmd.OpenForm "初期メニュー" & cPb_display, acNormal
        DoCmd.maximize
        DoCmd.Echo True
    
    Case "DAY01"                            ' 毎月1日実行月次バッチ時
        Call sPb_年月情報更新
        Application.Quit            ' ⇒忘れずに終了します

    Case "DAY010"                            ' 毎月10日実行月次バッチ時
    ・・・・
        
    Case Else
    End Select
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?